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):
|
||||
project_path = None
|
||||
lvl = 0
|
||||
for root, dirs, files in os.walk(path):
|
||||
if "settings.py" in files:
|
||||
project_path = root
|
||||
break
|
||||
if not os.path.isfile(os.path.join(path, "settings.py")):
|
||||
for d in os.listdir(path):
|
||||
if d in ('..', '.'):
|
||||
continue
|
||||
|
||||
lvl += 1
|
||||
if lvl > 2:
|
||||
break
|
||||
root = os.path.join(path, d)
|
||||
if os.path.isfile(os.path.join(root, "settings.py")):
|
||||
project_path = root
|
||||
break
|
||||
else:
|
||||
project_path = path
|
||||
elif os.path.isfile(path):
|
||||
project_path = os.path.dirname(path)
|
||||
settings_name, _ = os.path.splitext(os.path.basename(path))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user