Changeset - ff6da2e15e76
[Not reviewed]
0 1 0
Brett Smith - 4 years ago 2019-09-30 15:19:54
brettcsmith@brettcsmith.org
settings: Set default DATABASES and SECRET_KEY values when DEBUG.
1 file changed with 9 insertions and 8 deletions:
0 comments (0 inline, 0 general)
pinaxcon/settings.py
Show inline comments
...
 
@@ -9,11 +9,4 @@ 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")))
 

	
...
 
@@ -21,7 +14,13 @@ 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()
...
 
@@ -113,5 +112,7 @@ 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(&#2i5mq_^%%@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 = [
0 comments (0 inline, 0 general)