From 06a4dc6881ef0df5d2cedfdfa64ad9fa225862ab Mon Sep 17 00:00:00 2001 From: benoitc Date: Tue, 22 Jun 2010 13:10:49 +0200 Subject: [PATCH] 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. --- gunicorn/app/pasterapp.py | 11 ++++++++--- gunicorn/arbiter.py | 5 ++++- gunicorn/config.py | 2 -- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gunicorn/app/pasterapp.py b/gunicorn/app/pasterapp.py index cd4b1ac2..14eedd66 100644 --- a/gunicorn/app/pasterapp.py +++ b/gunicorn/app/pasterapp.py @@ -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() \ No newline at end of file + PasterServerApplication(app, gcfg=gcfg, host=host, port=port, *args, **kwargs).run() diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 8ff5740d..5a87f640 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -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): """\ diff --git a/gunicorn/config.py b/gunicorn/config.py index 43a84d85..1a7f4afd 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -72,8 +72,6 @@ class Config(object): @property def workers(self): - if self.settings['debug'].get(): - return 1 return self.settings['workers'].get() @property