From e9f67e2dda5c34233e10209df23661f146e5bdf7 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 20 Oct 2015 22:52:18 +0200 Subject: [PATCH] Update settings for Heroku --- duckbook/settings.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/duckbook/settings.py b/duckbook/settings.py index 7e14698..ff4cded 100644 --- a/duckbook/settings.py +++ b/duckbook/settings.py @@ -24,8 +24,9 @@ DEBUG = True TEMPLATE_DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['*'] +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_FOR') # Application definition @@ -60,12 +61,19 @@ WSGI_APPLICATION = 'duckbook.wsgi.application' # Database # https://docs.djangoproject.com/en/1.7/ref/settings/#databases -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), +try: + import dj_database_url + + DATABASES = { + 'default': dj_database_url.config() + } +except ImportError: + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } } -} # Internationalization # https://docs.djangoproject.com/en/1.7/topics/i18n/ @@ -87,6 +95,10 @@ USE_TZ = True STATIC_URL = '/static/' STATIC_ROOT = 'static' +STATICFILES_DIRS = ( + os.path.join(BASE_DIR, 'static'), +) + TEST_RUNNER = 'junorunner.testrunner.TestSuiteRunner' MAX_DUCK_LEVEL = 5