2016-11-22 21:50:21 +00:00
|
|
|
import os
|
2016-11-26 13:17:38 +00:00
|
|
|
import dj_database_url
|
2016-11-22 21:50:21 +00:00
|
|
|
|
2016-11-23 17:22:23 +00:00
|
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
2016-11-22 21:50:21 +00:00
|
|
|
|
|
|
|
ALLOWED_HOSTS = ['*']
|
|
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
2016-11-26 13:27:54 +00:00
|
|
|
DEBUG = os.environ['DEBUG']
|
2016-11-22 21:50:21 +00:00
|
|
|
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
2016-11-26 13:27:54 +00:00
|
|
|
SECRET_KEY = os.environ['SECRET_KEY']
|
2016-11-22 21:50:21 +00:00
|
|
|
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
|
|
|
|
|
|
|
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
|
|
'wagtail.wagtailforms',
|
|
|
|
'wagtail.wagtailredirects',
|
|
|
|
'wagtail.wagtailembeds',
|
|
|
|
'wagtail.wagtailsites',
|
|
|
|
'wagtail.wagtailusers',
|
|
|
|
'wagtail.wagtailsnippets',
|
|
|
|
'wagtail.wagtaildocs',
|
|
|
|
'wagtail.wagtailimages',
|
|
|
|
'wagtail.wagtailsearch',
|
|
|
|
'wagtail.wagtailadmin',
|
|
|
|
'wagtail.wagtailcore',
|
|
|
|
|
|
|
|
'wagtail.contrib.settings',
|
2016-11-24 19:59:51 +00:00
|
|
|
"wagtail.contrib.table_block",
|
2016-11-22 21:50:21 +00:00
|
|
|
|
|
|
|
'modelcluster',
|
|
|
|
'taggit',
|
|
|
|
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.messages',
|
|
|
|
'django.contrib.staticfiles',
|
2016-11-24 18:03:37 +00:00
|
|
|
|
2016-11-24 21:44:08 +00:00
|
|
|
'project.blog',
|
2016-11-24 18:03:37 +00:00
|
|
|
'project.common',
|
|
|
|
'project.home',
|
2016-11-25 23:12:40 +00:00
|
|
|
'project.projects',
|
2016-11-24 18:03:37 +00:00
|
|
|
'project.search',
|
2016-11-22 21:50:21 +00:00
|
|
|
]
|
|
|
|
|
2016-11-27 21:59:28 +00:00
|
|
|
if DEBUG:
|
|
|
|
INSTALLED_APPS += ['django.contrib.admin']
|
|
|
|
|
|
|
|
# Harden Django!
|
|
|
|
if not DEBUG:
|
|
|
|
SESSION_COOKIE_SECURE = True
|
|
|
|
CSRF_COOKIE_SECURE = True
|
|
|
|
CSRF_COOKIE_HTTPONLY = True
|
|
|
|
SECURE_CONTENT_TYPE_NOSNIFF = True
|
|
|
|
SECURE_BROWSER_XSS_FILTER = True
|
|
|
|
SECURE_SSL_REDIRECT = True
|
|
|
|
|
|
|
|
X_FRAME_OPTIONS = 'DENY'
|
|
|
|
MAX_UPLOAD_SIZE = 5242880 # 5MB - 5242880
|
|
|
|
|
|
|
|
|
2016-11-22 21:50:21 +00:00
|
|
|
MIDDLEWARE = [
|
2016-11-23 17:22:23 +00:00
|
|
|
'django.middleware.security.SecurityMiddleware',
|
|
|
|
|
|
|
|
'whitenoise.middleware.WhiteNoiseMiddleware',
|
|
|
|
|
2016-11-22 21:50:21 +00:00
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
|
|
|
|
|
|
'wagtail.wagtailcore.middleware.SiteMiddleware',
|
|
|
|
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
|
|
|
|
]
|
|
|
|
|
|
|
|
ROOT_URLCONF = 'project.urls'
|
|
|
|
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [
|
2016-11-23 17:22:23 +00:00
|
|
|
os.path.join(BASE_DIR, 'templates'),
|
2016-11-22 21:50:21 +00:00
|
|
|
],
|
|
|
|
'APP_DIRS': True,
|
|
|
|
'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',
|
2016-11-24 18:03:37 +00:00
|
|
|
'wagtail.contrib.settings.context_processors.settings',
|
|
|
|
'project.common.context.settings_injector'
|
2016-11-22 21:50:21 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
WSGI_APPLICATION = 'project.wsgi.application'
|
|
|
|
|
|
|
|
|
|
|
|
# Database
|
|
|
|
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
|
|
|
|
|
2016-11-26 13:17:38 +00:00
|
|
|
DATABASES = {
|
2016-11-26 15:34:47 +00:00
|
|
|
'default': dj_database_url.config(default="sqlite:///{}/db.sqlite3".format(BASE_DIR), conn_max_age=300)
|
2016-11-22 21:50:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Internationalization
|
|
|
|
# https://docs.djangoproject.com/en/1.10/topics/i18n/
|
|
|
|
|
2016-11-23 17:22:23 +00:00
|
|
|
LANGUAGE_CODE = 'en-GB'
|
2016-11-22 21:50:21 +00:00
|
|
|
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
|
|
|
|
STATICFILES_DIRS = [
|
2016-11-24 18:03:37 +00:00
|
|
|
os.path.join(BASE_DIR, 'static', 'build'),
|
2016-11-22 21:50:21 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
STATIC_ROOT = os.path.join(BASE_DIR, 'collected-static')
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
|
|
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|
|
|
MEDIA_URL = '/media/'
|
|
|
|
|
|
|
|
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
|
|
|
|
|
|
|
|
|
|
|
# Wagtail settings
|
|
|
|
|
|
|
|
WAGTAIL_SITE_NAME = "project"
|
|
|
|
|
2016-11-24 19:59:51 +00:00
|
|
|
WAGTAIL_PASSWORD_MANAGEMENT_ENABLED = True
|
|
|
|
WAGTAIL_ENABLE_UPDATE_CHECK = True
|
|
|
|
WAGTAIL_ALLOW_UNICODE_SLUGS = True
|
|
|
|
WAGTAIL_USAGE_COUNT_ENABLED = True
|
|
|
|
|
|
|
|
|
2016-11-22 21:50:21 +00:00
|
|
|
WAGTAILSEARCH_BACKENDS = {
|
|
|
|
'default': {
|
|
|
|
'BACKEND': 'wagtail.wagtailsearch.backends.db',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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
|
|
|
|
BASE_URL = 'http://example.com'
|
2016-11-24 18:03:37 +00:00
|
|
|
SITE_URL = BASE_URL
|