From ac9f38de53ea8fb85f3e234cb2fa7a118e93bfbb Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Fri, 1 Oct 2010 08:51:14 -0400 Subject: [PATCH] Fix up for `./manage.py run_gunicorn` --- .gitignore | 2 ++ gunicorn/app/djangoapp.py | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 6987f15c..a0809138 100755 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ gunicorn.egg-info nohup.out .coverage doc/.sass-cache +examples/frameworks/pylonstest/PasteScript* +examples/frameworks/pylonstest/pylonstest.egg-info/ diff --git a/gunicorn/app/djangoapp.py b/gunicorn/app/djangoapp.py index f8d38dde..f32b3d99 100644 --- a/gunicorn/app/djangoapp.py +++ b/gunicorn/app/djangoapp.py @@ -50,17 +50,20 @@ class DjangoApplication(Application): class DjangoApplicationCommand(Application): def __init__(self, options, admin_media_path): - self.cfg = Config() + self.config_file = options.get("config") or "" + self.options = options + self.admin_media_path = admin_media_path self.callable = None + self.load_config() - # Load up the config file if its found. - - config_file = options.get("config") or "" - if config_file and os.path.exists(config_file): + def load_config(self): + self.cfg = Config() + + if self.config_file and os.path.exists(self.config_file): cfg = { "__builtins__": __builtins__, "__name__": "__config__", - "__file__": config_file, + "__file__": self.config_file, "__doc__": None, "__package__": None } @@ -81,12 +84,10 @@ class DjangoApplicationCommand(Application): sys.stderr.write("Invalid value for %s: %s\n\n" % (k, v)) raise - for k, v in list(options.items()): + for k, v in list(self.options.items()): if k.lower() in self.cfg.settings and v is not None: self.cfg.set(k.lower(), v) - self.admin_media_path = admin_media_path - def load(self): try: return AdminMediaHandler(WSGIHandler(), self.admin_media_path)