Browse Source

Remove SECRET_KEY from settings

master
Nyymix 2 months ago
parent
commit
2b09a926d2
  1. 15
      config/settings.py

15
config/settings.py

@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/4.0/ref/settings/
"""
from pathlib import Path
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@ -19,12 +20,20 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-f+$aq02w$jj_pq+r533zo!4q9s7g+47@ul#9&2jrgzkp$tn*k#'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# SECURITY WARNING: keep the secret key used in production secret!
if os.getenv('SECRET_KEY'):
SECRET_KEY = os.getenv('SECRET_KEY')
else:
if DEBUG:
SECRET_KEY = "topsecret"
else:
print("Env: SECRET_KEY missing!")
exit(1)
ALLOWED_HOSTS = []

Loading…
Cancel
Save