[config] load testing env when under pytest
This commit is contained in:
parent
04cb10d13c
commit
30f6d6c8c1
2 changed files with 10 additions and 1 deletions
|
|
@ -10,13 +10,18 @@ https://docs.djangoproject.com/en/5.1/ref/settings/
|
|||
|
||||
import environ
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
env = environ.Env(
|
||||
DEBUG=(bool, False),
|
||||
DEV=(bool, False),
|
||||
)
|
||||
environ.Env.read_env(BASE_DIR / ".env")
|
||||
if "pytest/__main__.py" in sys.argv[0]:
|
||||
env.read_env(BASE_DIR / ".env.test")
|
||||
else:
|
||||
env.read_env(BASE_DIR / ".env")
|
||||
|
||||
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue