mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
allow config file to set proc_name. spotted by @jbergstroem on irc.
thanks!
This commit is contained in:
parent
971b3199a7
commit
6c48e91904
@ -13,7 +13,8 @@ from gunicorn import util
|
||||
class Config(object):
|
||||
|
||||
DEFAULTS = dict(
|
||||
proc_name = os.getcwd(),
|
||||
proc_name = None,
|
||||
default_proc_name = os.getcwd(),
|
||||
bind='127.0.0.1:8000',
|
||||
daemon=False,
|
||||
debug=False,
|
||||
@ -138,6 +139,11 @@ class Config(object):
|
||||
|
||||
return gid
|
||||
|
||||
@property
|
||||
def proc_name(self):
|
||||
if not self.conf.get('proc_name'):
|
||||
return self.conf.get('default_proc_name')
|
||||
return self.conf.get('proc_name')
|
||||
|
||||
def _hook(self, hookname, *args):
|
||||
hook = self.conf.get(hookname)
|
||||
|
||||
@ -142,8 +142,7 @@ def paste_server(app, global_conf=None, host="127.0.0.1", port=None,
|
||||
if key == "debug":
|
||||
value = (value == "true")
|
||||
options[key] = value
|
||||
if not 'proc_name' in options:
|
||||
options['proc_name'] = options['__file__']
|
||||
options['default_proc_name'] = options['__file__']
|
||||
|
||||
conf = Config(options)
|
||||
arbiter = Arbiter(conf.address, conf.workers, app, debug=conf["debug"],
|
||||
@ -164,8 +163,8 @@ def run():
|
||||
if len(args) != 1:
|
||||
parser.error("No application module specified.")
|
||||
|
||||
if not opts.proc_name:
|
||||
opts.proc_name = args[0]
|
||||
|
||||
opts.default_proc_name = args[0]
|
||||
|
||||
try:
|
||||
return util.import_app(args[0])
|
||||
@ -210,8 +209,7 @@ def run_django():
|
||||
settings_modname = '%s.%s' % (project_name, settings_name)
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = settings_modname
|
||||
|
||||
if not opts.proc_name:
|
||||
opts.proc_name = settings_modname
|
||||
opts.default_proc_name = settings_modname
|
||||
|
||||
# django wsgi app
|
||||
return django.core.handlers.wsgi.WSGIHandler()
|
||||
@ -269,8 +267,7 @@ def run_paster():
|
||||
if not opts.debug:
|
||||
opts.debug = (ctx.global_conf.get('debug') == "true")
|
||||
|
||||
if not opts.proc_name:
|
||||
opts.proc_name = ctx.global_conf.get('__file__')
|
||||
opts.default_proc_name= ctx.global_conf.get('__file__')
|
||||
|
||||
app = loadapp(config_url, relative_to=relative_to)
|
||||
return app
|
||||
|
||||
@ -53,8 +53,7 @@ class Command(BaseCommand):
|
||||
|
||||
options['bind'] = addrport or '127.0.0.1'
|
||||
|
||||
if not options.get('proc_name'):
|
||||
options['proc_name'] =settings.SETTINGS_MODULE
|
||||
options['default_proc_name'] =settings.SETTINGS_MODULE
|
||||
conf = Config(options, options.get('gconfig'))
|
||||
|
||||
admin_media_path = options.get('admin_media_path', '')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user