Skip to content

Commit

Permalink
get settings from dynaconf
Browse files Browse the repository at this point in the history
  • Loading branch information
ivancrneto committed Mar 1, 2024
1 parent 8fec6dc commit 61c7a45
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 8 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

from dynaconf import Dynaconf

djsettings = Dynaconf(
envvar_prefix="DJANGO",
settings_files=['settings.env', '.secrets.env'],
load_dotenv=True,
)
9 changes: 5 additions & 4 deletions webapp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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,
}
}

Expand Down

0 comments on commit 61c7a45

Please sign in to comment.