|
|
@@ -12,6 +12,8 @@ https://docs.djangoproject.com/en/2.2/ref/settings/
|
|
|
|
|
|
import os
|
|
|
|
|
|
+import dj_database_url
|
|
|
+
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
|
|
@@ -23,7 +25,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
SECRET_KEY = '%nu-#)p4b$z(983hj_##91%_^x=3n#*as874q8b439=q@4g0bx'
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
|
-DEBUG = True
|
|
|
+DEBUG = False
|
|
|
|
|
|
ALLOWED_HOSTS = []
|
|
|
|
|
|
@@ -37,10 +39,16 @@ INSTALLED_APPS = [
|
|
|
'django.contrib.sessions',
|
|
|
'django.contrib.messages',
|
|
|
'django.contrib.staticfiles',
|
|
|
+
|
|
|
+ 'whitenoise.runserver_nostatic'
|
|
|
]
|
|
|
|
|
|
MIDDLEWARE = [
|
|
|
'django.middleware.security.SecurityMiddleware',
|
|
|
+
|
|
|
+ # Add whitenoise middleware here
|
|
|
+ 'whitenoise.middleware.WhiteNoiseMiddleware',
|
|
|
+
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
@@ -79,7 +87,8 @@ DATABASES = {
|
|
|
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+db_from_env = dj_database_url.config(conn_max_age=500)
|
|
|
+DATABASES['default'].update(db_from_env)
|
|
|
|
|
|
# Password validation
|
|
|
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
|
|
|
@@ -118,3 +127,9 @@ USE_TZ = True
|
|
|
# https://docs.djangoproject.com/en/2.2/howto/static-files/
|
|
|
|
|
|
STATIC_URL = '/static/'
|
|
|
+
|
|
|
+STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
|
|
+
|
|
|
+ALLOWED_HOSTS = ['127.0.0.1', '.herokuapp.com']
|
|
|
+
|
|
|
+STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|