fix: APP_ROOT handles both root/ and app/ script locations
This commit is contained in:
parent
77cdacf878
commit
b4785d49ab
@ -32,7 +32,12 @@ import importlib.util
|
||||
# 配置
|
||||
# ============================================================
|
||||
|
||||
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||
_script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# 脚本可能在项目根目录或 app/ 子目录,统一指向项目根
|
||||
if os.path.basename(_script_dir) == 'app':
|
||||
APP_ROOT = os.path.dirname(_script_dir)
|
||||
else:
|
||||
APP_ROOT = _script_dir
|
||||
sys.path.insert(0, APP_ROOT)
|
||||
|
||||
# perm_config.py 路径
|
||||
|
||||
@ -32,7 +32,12 @@ import importlib.util
|
||||
# 配置
|
||||
# ============================================================
|
||||
|
||||
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||
_script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# 脚本可能在项目根目录或 app/ 子目录,统一指向项目根
|
||||
if os.path.basename(_script_dir) == 'app':
|
||||
APP_ROOT = os.path.dirname(_script_dir)
|
||||
else:
|
||||
APP_ROOT = _script_dir
|
||||
sys.path.insert(0, APP_ROOT)
|
||||
|
||||
# perm_config.py 路径
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user