mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
fix paster usage
This commit is contained in:
parent
73ed5f87b7
commit
9409839668
@ -84,7 +84,7 @@ class Config(object):
|
||||
|
||||
@property
|
||||
def worker_class(self):
|
||||
uri = self.cfg.get('workerclass', None) or 'egg:gunicorn#sync'
|
||||
uri = self.cfg.get('worker_class', None) or 'egg:gunicorn#sync'
|
||||
worker_class = util.load_worker_class(uri)
|
||||
if hasattr(worker_class, "setup"):
|
||||
worker_class.setup()
|
||||
|
||||
@ -169,6 +169,7 @@ def run_paster():
|
||||
pkg_resources.working_set.add_entry(relpath)
|
||||
ctx = loadwsgi.loadcontext(loadwsgi.SERVER, cfgurl, relative_to=relpath)
|
||||
|
||||
|
||||
if not opts.workers:
|
||||
opts.workers = ctx.local_conf.get('workers', 1)
|
||||
|
||||
@ -191,9 +192,14 @@ def run_paster():
|
||||
bind = host
|
||||
opts.bind = bind
|
||||
|
||||
for k, v in ctx.local_conf.items():
|
||||
if not hasattr(opts, k):
|
||||
setattr(opts, k, v)
|
||||
|
||||
if not opts.debug:
|
||||
opts.debug = (ctx.global_conf.get('debug') == "true")
|
||||
|
||||
|
||||
opts.default_proc_name= ctx.global_conf.get('__file__')
|
||||
|
||||
app = loadapp(cfgurl, relative_to=relpath)
|
||||
@ -227,8 +233,9 @@ def paste_server(app, gcfg=None, host="127.0.0.1", port=None, *args, **kwargs):
|
||||
value = (value == "true")
|
||||
opts[key] = value
|
||||
opts['default_proc_name'] = opts['__file__']
|
||||
|
||||
|
||||
cfg = Config(opts)
|
||||
|
||||
if cfg.spew:
|
||||
spew()
|
||||
if cfg.daemon:
|
||||
@ -236,7 +243,6 @@ def paste_server(app, gcfg=None, host="127.0.0.1", port=None, *args, **kwargs):
|
||||
else:
|
||||
os.setpgrp()
|
||||
configure_logging(cfg)
|
||||
|
||||
Arbiter(cfg, app).run()
|
||||
|
||||
def daemonize():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user