From ea6296c01692a88d8814f83db241eb0d54bb105b Mon Sep 17 00:00:00 2001 From: David Morris Date: Wed, 20 Sep 2023 20:46:07 +0100 Subject: [PATCH] Adding core settings for dotenv #17 --- core/settings.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/settings.py b/core/settings.py index f97037c..13b591a 100644 --- a/core/settings.py +++ b/core/settings.py @@ -12,6 +12,11 @@ from pathlib import Path +import os +from dotenv import load_dotenv +dotenv_path = os.path.join(os.path.dirname(__file__), '.env') +load_dotenv(dotenv_path) + # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -20,7 +25,9 @@ # See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = "django-insecure--xsax10=q^o9t9h3)i=4++48=96$+c#(inh#%#zufdw4^kk8s(" +# SECRET_KEY = "django-insecure--xsax10=q^o9t9h3)i=4++48=96$+c#(inh#%#zufdw4^kk8s(" +SECRET_KEY = str(os.getenv('SECRET_KEY')) + # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True