mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Merge pull request #701 from wking/700-debug-preload
Deprecate the --debug setting
This commit is contained in:
commit
97977e41ab
@ -215,10 +215,8 @@ debug
|
|||||||
* ``--debug``
|
* ``--debug``
|
||||||
* ``False``
|
* ``False``
|
||||||
|
|
||||||
Turn on debugging in the server.
|
**DEPRECATED**: This no functionality was removed after v18.0. This
|
||||||
|
option is now a no-op.
|
||||||
This limits the number of worker processes to 1 and changes some error
|
|
||||||
handling that's sent to clients.
|
|
||||||
|
|
||||||
reload
|
reload
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|||||||
@ -96,21 +96,16 @@ class Arbiter(object):
|
|||||||
self.worker_class = self.cfg.worker_class
|
self.worker_class = self.cfg.worker_class
|
||||||
self.address = self.cfg.address
|
self.address = self.cfg.address
|
||||||
self.num_workers = self.cfg.workers
|
self.num_workers = self.cfg.workers
|
||||||
self.debug = self.cfg.debug
|
|
||||||
self.timeout = self.cfg.timeout
|
self.timeout = self.cfg.timeout
|
||||||
self.proc_name = self.cfg.proc_name
|
self.proc_name = self.cfg.proc_name
|
||||||
|
|
||||||
if self.cfg.debug:
|
self.log.debug("Current configuration:")
|
||||||
self.log.debug("Current configuration:")
|
for config, value in sorted(self.cfg.settings.items(),
|
||||||
for config, value in sorted(self.cfg.settings.items(),
|
key=lambda setting: setting[1]):
|
||||||
key=lambda setting: setting[1]):
|
self.log.debug(" %s: %s", config, value.value)
|
||||||
self.log.debug(" %s: %s", config, value.value)
|
|
||||||
|
|
||||||
if self.cfg.preload_app:
|
if self.cfg.preload_app:
|
||||||
if not self.cfg.debug:
|
self.app.wsgi()
|
||||||
self.app.wsgi()
|
|
||||||
else:
|
|
||||||
self.log.warning("debug mode: app isn't preloaded.")
|
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
"""\
|
"""\
|
||||||
|
|||||||
@ -701,8 +701,8 @@ class Debug(Setting):
|
|||||||
desc = """\
|
desc = """\
|
||||||
Turn on debugging in the server.
|
Turn on debugging in the server.
|
||||||
|
|
||||||
This limits the number of worker processes to 1 and changes some error
|
**DEPRECATED**: This no functionality was removed after v18.0.
|
||||||
handling that's sent to clients.
|
This option is now a no-op.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,6 @@ class Worker(object):
|
|||||||
self.max_requests = cfg.max_requests or MAXSIZE
|
self.max_requests = cfg.max_requests or MAXSIZE
|
||||||
self.alive = True
|
self.alive = True
|
||||||
self.log = log
|
self.log = log
|
||||||
self.debug = cfg.debug
|
|
||||||
self.tmp = WorkerTmp(cfg)
|
self.tmp = WorkerTmp(cfg)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|||||||
@ -57,7 +57,7 @@ def test_property_access():
|
|||||||
# Class was loaded
|
# Class was loaded
|
||||||
t.eq(c.worker_class, SyncWorker)
|
t.eq(c.worker_class, SyncWorker)
|
||||||
|
|
||||||
# Debug affects workers
|
# Workers defaults to 1
|
||||||
t.eq(c.workers, 1)
|
t.eq(c.workers, 1)
|
||||||
c.set("workers", 3)
|
c.set("workers", 3)
|
||||||
t.eq(c.workers, 3)
|
t.eq(c.workers, 3)
|
||||||
@ -89,15 +89,15 @@ def test_property_access():
|
|||||||
|
|
||||||
def test_bool_validation():
|
def test_bool_validation():
|
||||||
c = config.Config()
|
c = config.Config()
|
||||||
t.eq(c.debug, False)
|
t.eq(c.preload_app, False)
|
||||||
c.set("debug", True)
|
c.set("preload_app", True)
|
||||||
t.eq(c.debug, True)
|
t.eq(c.preload_app, True)
|
||||||
c.set("debug", "true")
|
c.set("preload_app", "true")
|
||||||
t.eq(c.debug, True)
|
t.eq(c.preload_app, True)
|
||||||
c.set("debug", "false")
|
c.set("preload_app", "false")
|
||||||
t.eq(c.debug, False)
|
t.eq(c.preload_app, False)
|
||||||
t.raises(ValueError, c.set, "debug", "zilch")
|
t.raises(ValueError, c.set, "preload_app", "zilch")
|
||||||
t.raises(TypeError, c.set, "debug", 4)
|
t.raises(TypeError, c.set, "preload_app", 4)
|
||||||
|
|
||||||
def test_pos_int_validation():
|
def test_pos_int_validation():
|
||||||
c = config.Config()
|
c = config.Config()
|
||||||
@ -169,9 +169,9 @@ def test_cmd_line():
|
|||||||
with AltArgs(["prog_name", "-w", "3"]):
|
with AltArgs(["prog_name", "-w", "3"]):
|
||||||
app = NoConfigApp()
|
app = NoConfigApp()
|
||||||
t.eq(app.cfg.workers, 3)
|
t.eq(app.cfg.workers, 3)
|
||||||
with AltArgs(["prog_name", "--debug"]):
|
with AltArgs(["prog_name", "--preload"]):
|
||||||
app = NoConfigApp()
|
app = NoConfigApp()
|
||||||
t.eq(app.cfg.debug, True)
|
t.eq(app.cfg.preload_app, True)
|
||||||
|
|
||||||
def test_app_config():
|
def test_app_config():
|
||||||
with AltArgs():
|
with AltArgs():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user