mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
allows worker_class uri shortcut. It's now possible to do :
gunicorn -w 3 -k gevent test:app ie. removing the need of using egg:gunicorn before.
This commit is contained in:
parent
dbd66b6191
commit
aca70fbec8
@ -58,7 +58,13 @@ def load_worker_class(uri):
|
|||||||
else:
|
else:
|
||||||
components = uri.split('.')
|
components = uri.split('.')
|
||||||
if len(components) == 1:
|
if len(components) == 1:
|
||||||
raise RuntimeError("arbiter uri invalid")
|
try:
|
||||||
|
if uri.startswith("#"):
|
||||||
|
uri = uri[1:]
|
||||||
|
return pkg_resources.load_entry_point("gunicorn",
|
||||||
|
"gunicorn.workers", uri)
|
||||||
|
except ImportError:
|
||||||
|
raise RuntimeError("arbiter uri invalid or not found")
|
||||||
klass = components.pop(-1)
|
klass = components.pop(-1)
|
||||||
mod = __import__('.'.join(components))
|
mod = __import__('.'.join(components))
|
||||||
for comp in components[1:]:
|
for comp in components[1:]:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user