From 68c10c33a52d9950346110447ba3b0c3a6907290 Mon Sep 17 00:00:00 2001 From: Karl Wooster Date: Mon, 18 Mar 2024 22:55:19 -0700 Subject: [PATCH] refactor(optimize-settings): make a few settings env variables; add constance to INSTALLED_APPS --- .env-sample-production | 1 + config/settings/base.py | 2 ++ config/settings/local.py | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .env-sample-production diff --git a/.env-sample-production b/.env-sample-production new file mode 100644 index 0000000..97d09ad --- /dev/null +++ b/.env-sample-production @@ -0,0 +1 @@ +DATABASE_URL=postgres://wooster_django:postgres@10.46.118.26:15432/postgres diff --git a/config/settings/base.py b/config/settings/base.py index e380b0c..288ba78 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -1,6 +1,7 @@ """ Base settings to build other settings files upon. """ + from pathlib import Path import environ # type:ignore @@ -94,6 +95,7 @@ "allauth", "allauth.account", "allauth.socialaccount", + "constance", ] LOCAL_APPS = [ diff --git a/config/settings/local.py b/config/settings/local.py index c0894fd..f5be1d8 100644 --- a/config/settings/local.py +++ b/config/settings/local.py @@ -26,9 +26,9 @@ # EMAIL # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#email-host -EMAIL_HOST = "10.46.119.26" +EMAIL_HOST = env.str("DJANGO_EMAIL_HOST", default="localhost") # https://docs.djangoproject.com/en/dev/ref/settings/#email-port -EMAIL_PORT = 1025 +EMAIL_PORT = env.int("DJANGO_EMAIL_PORT", default=1025) # WhiteNoise # ------------------------------------------------------------------------------