diff --git a/config.py b/config.py new file mode 100644 index 0000000..505661a --- /dev/null +++ b/config.py @@ -0,0 +1,8 @@ + +from dynaconf import Dynaconf + +djsettings = Dynaconf( + envvar_prefix="DJANGO", + settings_files=['settings.env', '.secrets.env'], + load_dotenv=True, +) \ No newline at end of file diff --git a/webapp/settings.py b/webapp/settings.py index 01f8c81..d12afd6 100644 --- a/webapp/settings.py +++ b/webapp/settings.py @@ -11,6 +11,7 @@ """ from pathlib import Path +from config import djsettings # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -20,12 +21,12 @@ # See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = "django-insecure-btjo6x^cvh1#srimom#couy&qs92ozh6t@#n4n9@%9%-ps_71g" +SECRET_KEY = djsettings.SECRET_KEY # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = djsettings.ALLOWED_HOSTS # Application definition @@ -76,8 +77,8 @@ DATABASES = { "default": { - "ENGINE": "django.db.backends.sqlite3", - "NAME": BASE_DIR / "db.sqlite3", + "ENGINE": djsettings.DATABASES__default__ENGINE, + "NAME": djsettings.DATABASES__default__NAME, } }