mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
give the initial global_conf to loadcontext to initialize the context properly.
This commit is contained in:
parent
3fcd1b969c
commit
f5847a2a52
@ -21,9 +21,10 @@ from gunicorn import util
|
|||||||
|
|
||||||
|
|
||||||
class PasterBaseApplication(Application):
|
class PasterBaseApplication(Application):
|
||||||
|
gcfg = None
|
||||||
|
|
||||||
def app_config(self):
|
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()
|
gc, lc = cx.global_conf.copy(), cx.local_conf.copy()
|
||||||
cfg = {}
|
cfg = {}
|
||||||
|
|
||||||
@ -85,13 +86,14 @@ class PasterApplication(PasterBaseApplication):
|
|||||||
return self.app_config()
|
return self.app_config()
|
||||||
|
|
||||||
def load(self):
|
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):
|
class PasterServerApplication(PasterBaseApplication):
|
||||||
|
|
||||||
def __init__(self, app, gcfg=None, host="127.0.0.1", port=None, *args, **kwargs):
|
def __init__(self, app, gcfg=None, host="127.0.0.1", port=None, *args, **kwargs):
|
||||||
self.cfg = Config()
|
self.cfg = Config()
|
||||||
|
self.gcfg = gcfg # need to hold this for app_config
|
||||||
self.app = app
|
self.app = app
|
||||||
self.callable = None
|
self.callable = None
|
||||||
|
|
||||||
@ -138,7 +140,7 @@ class PasterServerApplication(PasterBaseApplication):
|
|||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
if hasattr(self, "cfgfname"):
|
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
|
return self.app
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user