settings: Set default DATABASES and SECRET_KEY values when DEBUG.
This commit is contained in:
parent
f2cb50a848
commit
ff6da2e15e
1 changed files with 9 additions and 8 deletions
|
@ -8,21 +8,20 @@ BASE_DIR = PACKAGE_ROOT
|
|||
|
||||
DEBUG = bool(int(os.environ.get("DJANGO_DEBUG", "1")))
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": os.path.join(PROJECT_ROOT, "dev.db"),
|
||||
}
|
||||
}
|
||||
|
||||
UNPREPEND_WWW = bool(int(os.environ.get("DJANGO_UNPREPEND_WWW", "0")))
|
||||
|
||||
APPEND_SLASH = True
|
||||
|
||||
# HEROKU: Update database configuration with $DATABASE_URL.
|
||||
DATABASES = {"default": {}}
|
||||
import dj_database_url
|
||||
db_from_env = dj_database_url.config()
|
||||
DATABASES['default'].update(db_from_env)
|
||||
if DEBUG and not DATABASES['default']:
|
||||
DATABASES['default'] = {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": os.path.join(PROJECT_ROOT, "dev.db"),
|
||||
}
|
||||
|
||||
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS", "localhost").split()
|
||||
CANONICAL_HOST = os.environ.get("DJANGO_CANONICAL_HOST", None)
|
||||
|
@ -112,7 +111,9 @@ AWS_STORAGE_BUCKET_NAME = os.environ.get("DJANGO_AWS_STORAGE_BUCKET_NAME", None)
|
|||
|
||||
|
||||
# Make this unique, and don't share it with anybody.
|
||||
SECRET_KEY = "6r&z0i#!k-thu4nv^zzx!f$fbp(i5mq_^%%@ihu_qxxotl_"
|
||||
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', '').strip()
|
||||
if (not SECRET_KEY) and DEBUG:
|
||||
SECRET_KEY = 'Ae=)D4\V=OFh~C63MJHgpc&6~"p-7>^2ux3#Cr;p^!RGw9.BT}U`pi|b04TDv_NB'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue