diff --git a/gunicorn/app/pasterapp.py b/gunicorn/app/pasterapp.py index b6e4f0e9..f3f04bf0 100644 --- a/gunicorn/app/pasterapp.py +++ b/gunicorn/app/pasterapp.py @@ -21,9 +21,10 @@ from gunicorn import util class PasterBaseApplication(Application): + gcfg = None def app_config(self): - cx = loadwsgi.loadcontext(SERVER, self.cfgurl, relative_to=self.relpath) + cx = loadwsgi.loadcontext(SERVER, self.cfgurl, relative_to=self.relpath, global_conf=self.gcfg) gc, lc = cx.global_conf.copy(), cx.local_conf.copy() cfg = {} @@ -85,13 +86,14 @@ class PasterApplication(PasterBaseApplication): return self.app_config() def load(self): - return loadapp(self.cfgurl, relative_to=self.relpath) + return loadapp(self.cfgurl, relative_to=self.relpath, global_conf=self.gcfg) class PasterServerApplication(PasterBaseApplication): def __init__(self, app, gcfg=None, host="127.0.0.1", port=None, *args, **kwargs): self.cfg = Config() + self.gcfg = gcfg # need to hold this for app_config self.app = app self.callable = None @@ -138,7 +140,7 @@ class PasterServerApplication(PasterBaseApplication): def load(self): if hasattr(self, "cfgfname"): - return loadapp(self.cfgurl, relative_to=self.relpath) + return loadapp(self.cfgurl, relative_to=self.relpath, global_conf=self.gcfg) return self.app