fix(config): enable overriding of environment variables when loading .env file
This commit is contained in:
parent
93e1a592df
commit
40f7035947
1 changed files with 2 additions and 2 deletions
|
|
@ -11,10 +11,10 @@ from dotenv import load_dotenv
|
|||
project_root_env = os.path.join(os.path.dirname(__file__), '../../.env')
|
||||
|
||||
if os.path.exists(project_root_env):
|
||||
load_dotenv(project_root_env)
|
||||
load_dotenv(project_root_env, override=True)
|
||||
else:
|
||||
# 如果根目录没有 .env,尝试加载环境变量(用于生产环境)
|
||||
load_dotenv()
|
||||
load_dotenv(override=True)
|
||||
|
||||
|
||||
class Config:
|
||||
|
|
|
|||
Loading…
Reference in a new issue