mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
I thought global_conf would be enough to get all info from paster.
Obviously I was wrong, we also need to use local_conf. Spotted by @gawel on irc.
This commit is contained in:
parent
00fa4313c8
commit
23af620000
@ -57,11 +57,18 @@ def get_app(parser, opts, args):
|
||||
pkg_resources.working_set.add_entry(relative_to)
|
||||
ctx = loadwsgi.loadcontext(loadwsgi.SERVER, config_url,
|
||||
relative_to=relative_to)
|
||||
|
||||
if opts.workers:
|
||||
workers = opts.workers
|
||||
else:
|
||||
workers = int(ctx.local_conf.get('workers', 1))
|
||||
|
||||
debug = ctx.global_conf.get('debug') == "true"
|
||||
if debug:
|
||||
# we force to one worker in debug mode.
|
||||
opts.workers = 1
|
||||
workers = 1
|
||||
|
||||
opts.workers=workers
|
||||
app = loadapp(config_url, relative_to=relative_to)
|
||||
return app
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ error_email_from = paste@localhost
|
||||
use = egg:gunicorn#main
|
||||
host = 127.0.0.1
|
||||
port = 5000
|
||||
workers = 2
|
||||
|
||||
[app:main]
|
||||
use = egg:pylonstest
|
||||
|
||||
@ -23,7 +23,7 @@ def options():
|
||||
help='Host to listen on. [%default]'),
|
||||
op.make_option('--port', dest='port', default=8000, type='int',
|
||||
help='Port to listen on. [%default]'),
|
||||
op.make_option('--workers', dest='workers', default=1, type='int',
|
||||
op.make_option('--workers', dest='workers', type='int',
|
||||
help='Number of workers to spawn. [%default]'),
|
||||
op.make_option('--log-level', dest='loglevel', default='info',
|
||||
help='Log level below which to silence messages. [%default]'),
|
||||
@ -54,7 +54,7 @@ def main(usage, get_app):
|
||||
configure_logging(opts)
|
||||
|
||||
app = get_app(parser, opts, args)
|
||||
workers = opts.workers
|
||||
workers = opts.workers or 1
|
||||
if opts.debug:
|
||||
workers = 1
|
||||
|
||||
@ -71,11 +71,10 @@ def paste_server(app, global_conf=None, host="127.0.0.1", port=None,
|
||||
port = 8000
|
||||
bind_addr = (host, int(port))
|
||||
|
||||
if not global_conf:
|
||||
workers=1
|
||||
else:
|
||||
workers = int(global_conf.get('workers', 1))
|
||||
|
||||
workers = kwargs.get("workers", 1)
|
||||
if global_conf:
|
||||
workers = int(global_conf.get('workers', workers))
|
||||
|
||||
debug = global_conf.get('debug') == "true"
|
||||
if debug:
|
||||
# we force to one worker in debug mode.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user