mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
found the settings file in eahc nested folders. Fix issue #340
This commit is contained in:
parent
8835b5f04d
commit
1faea03263
@ -16,15 +16,17 @@ def find_settings_module(path):
|
|||||||
|
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
project_path = None
|
project_path = None
|
||||||
lvl = 0
|
if not os.path.isfile(os.path.join(path, "settings.py")):
|
||||||
for root, dirs, files in os.walk(path):
|
for d in os.listdir(path):
|
||||||
if "settings.py" in files:
|
if d in ('..', '.'):
|
||||||
project_path = root
|
continue
|
||||||
break
|
|
||||||
|
|
||||||
lvl += 1
|
root = os.path.join(path, d)
|
||||||
if lvl > 2:
|
if os.path.isfile(os.path.join(root, "settings.py")):
|
||||||
break
|
project_path = root
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
project_path = path
|
||||||
elif os.path.isfile(path):
|
elif os.path.isfile(path):
|
||||||
project_path = os.path.dirname(path)
|
project_path = os.path.dirname(path)
|
||||||
settings_name, _ = os.path.splitext(os.path.basename(path))
|
settings_name, _ = os.path.splitext(os.path.basename(path))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user