Refactor: Will not force user to set SECRET_KEY in environ

+ Allow overwrite in local_settings.py (the original implemetation
  will cause an KeyError)
This commit is contained in:
winkidney
2018-09-08 03:43:52 -07:00
parent 703b23998f
commit e8bf3d4b30

View File

@@ -1,8 +1,14 @@
import logging
from .base import *
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ['SECRET_KEY']
if 'SECRET_KEY' not in os.environ:
logging.warning(
"No SECRET_KEY given in environ, please have a check"
)
SECRET_KEY = os.environ.get('SECRET_KEY', None)
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False