fix(settings): use settings file if present else use env var

This commit is contained in:
Loïc Gremaud 2026-06-12 02:28:48 +02:00
parent d7014f1cf8
commit 61f1457453
Signed by: Legrems
GPG Key ID: D4620E6DF3E0121D

View File

@ -6,7 +6,11 @@ BASE_DIR = Path(__file__).resolve().parent.parent
class Settings(BaseSettings): class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=BASE_DIR / ".env", env_file_encoding="utf-8") _env_file = BASE_DIR / ".env"
model_config = SettingsConfigDict(
env_file=_env_file if _env_file.exists() else None,
env_file_encoding="utf-8",
)
django_secret_key: str = "" django_secret_key: str = ""
debug: bool = True debug: bool = True