Configure project settings so that its secret key is stored safely in a .env file

parent c7525956
SECRET_KEY= os.getenv('SECRET_KEY') SECRET_KEY= 'django-insecure-%sref4cve4o0bsht4u_if@gg#%872m_br-es$bvnp#n$g936i7'
STATIC_ROOT='<folder path of where static items>' STATIC_ROOT='<folder path of where static items>'
\ No newline at end of file
...@@ -12,8 +12,9 @@ https://docs.djangoproject.com/en/4.0/ref/settings/ ...@@ -12,8 +12,9 @@ https://docs.djangoproject.com/en/4.0/ref/settings/
from pathlib import Path from pathlib import Path
from dotenv import load_dotenv from dotenv import load_dotenv
import os
load_dotenv load_dotenv()
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
...@@ -22,7 +23,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent ...@@ -22,7 +23,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-%sref4cve4o0bsht4u_if@gg#%872m_br-es$bvnp#n$g936i7' SECRET_KEY = os.getenv('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment