mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
fix one error in gunicorn_paster, global conf was ignored... While I'm
here change a little the behaviour of debug mode so we can still have multiple workers in gunicorn : - Don't preload app - Set wsgi.multiprocess=False rationnal is that when app isn't loaded it run in its own thread and can't be evaluated by another process simultaneously. So setting wsgi.multiprocess in this case sound good.
This commit is contained in:
parent
6121ace7e7
commit
06a4dc6881
@ -47,7 +47,12 @@ class PasterApplication(Application):
|
||||
cfg['workers'] = int(lc.get('workers', 1))
|
||||
cfg['umask'] = int(lc.get('umask', 0))
|
||||
cfg['default_proc_name'] = gc.get('__file__')
|
||||
|
||||
|
||||
for k, v in gc.items():
|
||||
if k not in self.cfg.settings:
|
||||
continue
|
||||
cfg[k] = v
|
||||
|
||||
for k, v in lc.items():
|
||||
if k not in self.cfg.settings:
|
||||
continue
|
||||
@ -81,7 +86,7 @@ class PasterServerApplication(Application):
|
||||
for k, v in list(cfg.items()):
|
||||
if k.lower() in self.cfg.settings and v is not None:
|
||||
self.cfg.set(k.lower(), v)
|
||||
|
||||
|
||||
self.configure_logging()
|
||||
|
||||
def load(self):
|
||||
@ -109,4 +114,4 @@ def paste_server(app, gcfg=None, host="127.0.0.1", port=None, *args, **kwargs):
|
||||
|
||||
"""
|
||||
from gunicorn.app.pasterapp import PasterServerApplication
|
||||
PasterServerApplication(app, gcfg=gcfg, host=host, port=port, *args, **kwargs).run()
|
||||
PasterServerApplication(app, gcfg=gcfg, host=host, port=port, *args, **kwargs).run()
|
||||
|
||||
@ -89,7 +89,10 @@ class Arbiter(object):
|
||||
self.worker_class = self.cfg.worker_class
|
||||
|
||||
if self.cfg.preload_app:
|
||||
self.app.wsgi()
|
||||
if not self.cfg.debug:
|
||||
self.app.wsgi()
|
||||
else:
|
||||
self.log.warning("debug mode: app isn't preloaded.")
|
||||
|
||||
def start(self):
|
||||
"""\
|
||||
|
||||
@ -72,8 +72,6 @@ class Config(object):
|
||||
|
||||
@property
|
||||
def workers(self):
|
||||
if self.settings['debug'].get():
|
||||
return 1
|
||||
return self.settings['workers'].get()
|
||||
|
||||
@property
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user