Changeset - 800ed7d57a3e
[Not reviewed]
0 1 0
Brett Smith - 2 years ago 2018-10-04 20:16:52
brettcsmith@brettcsmith.org
settings: Set default DATABASES and SECRET_KEY values when DEBUG.
1 file changed with 9 insertions and 9 deletions:
0 comments (0 inline, 0 general)
pinaxcon/settings.py
Show inline comments
...
 
@@ -8,17 +8,15 @@ 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"),
 
    }
 
}
 

	
 
# 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)
...
 
@@ -95,7 +93,9 @@ STATICFILES_FINDERS = [
 
]
 

	
 
# 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)