mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
expose --pythonpath command to all modes . fix #433
--pythonpath may also be useful in other commands, so expose it to all.
This commit is contained in:
parent
23f66c2389
commit
9fb0d9669c
@ -482,6 +482,9 @@ The Python path to a Django settings module.
|
|||||||
e.g. 'myproject.settings.main'. If this isn't provided, the
|
e.g. 'myproject.settings.main'. If this isn't provided, the
|
||||||
DJANGO_SETTINGS_MODULE environment variable will be used.
|
DJANGO_SETTINGS_MODULE environment variable will be used.
|
||||||
|
|
||||||
|
Server Mechanics
|
||||||
|
----------------
|
||||||
|
|
||||||
pythonpath
|
pythonpath
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@ -115,6 +115,14 @@ class Application(object):
|
|||||||
if self.cfg.daemon:
|
if self.cfg.daemon:
|
||||||
util.daemonize()
|
util.daemonize()
|
||||||
|
|
||||||
|
# set python paths
|
||||||
|
if self.cfg.pythonpath and self.cfg.pythonpath is not None:
|
||||||
|
paths = self.cfg.pythonpath.split(",")
|
||||||
|
for path in paths:
|
||||||
|
pythonpath = os.path.abspath(self.cfg.pythonpath)
|
||||||
|
if pythonpath not in sys.path:
|
||||||
|
sys.path.insert(0, pythonpath)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
Arbiter(self).run()
|
Arbiter(self).run()
|
||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
|
|||||||
@ -44,9 +44,11 @@ def make_default_env(cfg):
|
|||||||
os.environ['DJANGO_SETTINGS_MODULE'] = cfg.django_settings
|
os.environ['DJANGO_SETTINGS_MODULE'] = cfg.django_settings
|
||||||
|
|
||||||
if cfg.pythonpath and cfg.pythonpath is not None:
|
if cfg.pythonpath and cfg.pythonpath is not None:
|
||||||
pythonpath = os.path.abspath(cfg.pythonpath)
|
paths = cfg.pythonpath.split(",")
|
||||||
if pythonpath not in sys.path:
|
for path in paths:
|
||||||
sys.path.insert(0, pythonpath)
|
pythonpath = os.path.abspath(cfg.pythonpath)
|
||||||
|
if pythonpath not in sys.path:
|
||||||
|
sys.path.insert(0, pythonpath)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.environ['DJANGO_SETTINGS_MODULE']
|
os.environ['DJANGO_SETTINGS_MODULE']
|
||||||
|
|||||||
@ -867,9 +867,9 @@ class DjangoSettings(Setting):
|
|||||||
DJANGO_SETTINGS_MODULE environment variable will be used.
|
DJANGO_SETTINGS_MODULE environment variable will be used.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class DjangoPythonPath(Setting):
|
class PythonPath(Setting):
|
||||||
name = "pythonpath"
|
name = "pythonpath"
|
||||||
section = "Django"
|
section = "Server Mechanics"
|
||||||
cli = ["--pythonpath"]
|
cli = ["--pythonpath"]
|
||||||
meta = "STRING"
|
meta = "STRING"
|
||||||
validator = validate_string
|
validator = validate_string
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user