2018-07-22 17:12:04 +01:00
|
|
|
"""
|
|
|
|
Django settings for project project.
|
|
|
|
|
|
|
|
Generated by 'django-admin startproject' using Django 2.0.7.
|
|
|
|
|
|
|
|
For more information on this file, see
|
|
|
|
https://docs.djangoproject.com/en/2.0/topics/settings/
|
|
|
|
|
|
|
|
For the full list of settings and their values, see
|
|
|
|
https://docs.djangoproject.com/en/2.0/ref/settings/
|
|
|
|
"""
|
|
|
|
|
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
|
|
import os
|
|
|
|
import dj_database_url
|
|
|
|
import django_cache_url
|
|
|
|
|
|
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
|
2018-07-24 21:16:55 +01:00
|
|
|
WAGTAIL_SITE_NAME = "project"
|
|
|
|
|
|
|
|
# Base URL to use when referring to full URLs within the Wagtail admin backend -
|
|
|
|
# e.g. in notification emails. Don't include '/admin' or a trailing slash
|
2018-07-24 21:49:39 +01:00
|
|
|
BASE_URL = os.environ['BASE_URL']
|
2018-07-24 21:16:55 +01:00
|
|
|
|
|
|
|
DEBUG = True
|
|
|
|
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
|
|
SECRET_KEY = '@%p6v$-d_+)v!=5ow9-*!lw@2n+&9!f83^+p)#jegc%7h122xe'
|
|
|
|
|
|
|
|
# SECURITY WARNING: define the correct hosts in production!
|
|
|
|
ALLOWED_HOSTS = ['*']
|
|
|
|
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
|
|
|
|
2018-07-22 17:12:04 +01:00
|
|
|
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
|
|
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
|
|
|
|
|
|
|
|
|
|
|
|
# Application definition
|
|
|
|
|
|
|
|
INSTALLED_APPS = [
|
|
|
|
'project.home',
|
|
|
|
'project.search',
|
2018-07-24 20:56:38 +01:00
|
|
|
'project.common',
|
2018-07-25 09:03:00 +01:00
|
|
|
'project.pages',
|
2018-07-26 08:44:14 +01:00
|
|
|
'project.blog',
|
2018-07-22 17:12:04 +01:00
|
|
|
|
|
|
|
'wagtail.contrib.forms',
|
|
|
|
'wagtail.contrib.redirects',
|
2018-08-03 13:20:33 +01:00
|
|
|
'wagtail.contrib.routable_page',
|
2018-07-22 17:12:04 +01:00
|
|
|
'wagtail.embeds',
|
|
|
|
'wagtail.sites',
|
|
|
|
'wagtail.users',
|
|
|
|
'wagtail.snippets',
|
|
|
|
'wagtail.documents',
|
|
|
|
'wagtail.images',
|
|
|
|
'wagtail.search',
|
|
|
|
'wagtail.admin',
|
|
|
|
'wagtail.core',
|
|
|
|
|
|
|
|
'modelcluster',
|
|
|
|
'taggit',
|
|
|
|
|
2018-07-24 20:56:38 +01:00
|
|
|
'wagtailmetadata',
|
|
|
|
|
2018-07-22 17:12:04 +01:00
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.messages',
|
|
|
|
'whitenoise.runserver_nostatic',
|
|
|
|
'django.contrib.staticfiles',
|
|
|
|
]
|
|
|
|
|
|
|
|
MIDDLEWARE = [
|
|
|
|
'django.middleware.gzip.GZipMiddleware',
|
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
|
|
'django.middleware.security.SecurityMiddleware',
|
|
|
|
'whitenoise.middleware.WhiteNoiseMiddleware',
|
|
|
|
|
|
|
|
'wagtail.core.middleware.SiteMiddleware',
|
|
|
|
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
|
|
|
|
]
|
|
|
|
|
|
|
|
ROOT_URLCONF = 'project.urls'
|
|
|
|
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [
|
|
|
|
os.path.join(BASE_DIR, 'templates'),
|
|
|
|
],
|
2018-07-24 21:16:55 +01:00
|
|
|
'APP_DIRS': True,
|
2018-07-22 17:12:04 +01:00
|
|
|
'OPTIONS': {
|
|
|
|
'context_processors': [
|
|
|
|
'django.template.context_processors.debug',
|
|
|
|
'django.template.context_processors.request',
|
|
|
|
'django.contrib.auth.context_processors.auth',
|
|
|
|
'django.contrib.messages.context_processors.messages',
|
2018-07-26 09:22:19 +01:00
|
|
|
'project.common.context.settings_injector',
|
|
|
|
'project.common.context.get_home_page'
|
2018-07-22 17:12:04 +01:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2018-07-24 21:16:55 +01:00
|
|
|
if not DEBUG:
|
|
|
|
TEMPLATES[0]['OPTIONS']['loaders'] = [
|
|
|
|
('django.template.loaders.cached.Loader', [
|
|
|
|
'django.template.loaders.filesystem.Loader',
|
|
|
|
'django.template.loaders.app_directories.Loader',
|
|
|
|
]),
|
|
|
|
]
|
|
|
|
del TEMPLATES[0]['APP_DIRS']
|
|
|
|
|
|
|
|
|
2018-07-22 17:12:04 +01:00
|
|
|
WSGI_APPLICATION = 'project.wsgi.application'
|
|
|
|
|
|
|
|
|
|
|
|
# Database
|
|
|
|
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
|
|
|
|
|
|
|
|
DATABASES = {
|
|
|
|
'default': dj_database_url.config(conn_max_age=500)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Internationalization
|
|
|
|
# https://docs.djangoproject.com/en/2.0/topics/i18n/
|
|
|
|
|
|
|
|
LANGUAGE_CODE = 'en-gb'
|
|
|
|
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
|
|
# https://docs.djangoproject.com/en/2.0/howto/static-files/
|
|
|
|
|
|
|
|
|
|
|
|
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
|
|
|
|
|
|
|
|
|
|
|
|
STATICFILES_DIRS = (
|
|
|
|
os.path.join(BASE_DIR, "static", "build"),
|
|
|
|
)
|
|
|
|
|
|
|
|
STATIC_ROOT = os.path.join(BASE_DIR, 'collected-static')
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
|
|
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|
|
|
MEDIA_URL = '/media/'
|
|
|
|
|
|
|
|
|
|
|
|
# Wagtail settings
|
|
|
|
|
|
|
|
|
|
|
|
if 'CACHE_URL' in os.environ:
|
|
|
|
CACHES = {'default': django_cache_url.config()}
|
|
|
|
|
|
|
|
if 'ELASTICSEARCH_URL' in os.environ:
|
|
|
|
WAGTAILSEARCH_BACKENDS = {
|
|
|
|
'default': {
|
|
|
|
'BACKEND': 'wagtail.search.backends.elasticsearch2',
|
|
|
|
'URLS': [os.environ['ELASTICSEARCH_URL']],
|
|
|
|
'INDEX': 'wagtail',
|
|
|
|
'TIMEOUT': 5,
|
|
|
|
'OPTIONS': {},
|
|
|
|
'INDEX_SETTINGS': {},
|
|
|
|
}
|
|
|
|
}
|