1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
theorangeone.net-legacy/project/settings.py

171 lines
4.2 KiB
Python
Raw Normal View History

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']
ENABLE_ADMIN = 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-12-03 20:49:24 +00:00
'wagtail.contrib.wagtailstyleguide',
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-12-15 22:00:42 +00:00
'wagtailmetadata',
2016-12-17 22:22:16 +00:00
'bootstrapform',
2016-12-15 22:00:42 +00:00
2016-11-24 21:44:08 +00:00
'project.blog',
'project.common',
'project.home',
2016-11-28 21:36:11 +00:00
'project.pages',
2016-11-25 23:12:40 +00:00
'project.projects',
'project.search',
2016-11-22 21:50:21 +00:00
]
if ENABLE_ADMIN:
2016-11-27 21:59:28 +00:00
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'
2016-11-27 22:01:09 +00:00
MAX_UPLOAD_SIZE = 5242880 # 5MB - 5242880
2016-11-27 21:59:28 +00:00
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',
2016-12-15 22:00:42 +00:00
'wagtail.wagtailredirects.middleware.RedirectMiddleware'
2016-11-22 21:50:21 +00:00
]
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',
'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 = [
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
2016-12-05 15:25:19 +00:00
WAGTAIL_SITE_NAME = "TheOrangeOne"
2016-11-22 21:50:21 +00:00
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-12-05 15:25:19 +00:00
WAGTAILIMAGES_JPEG_QUALITY = 100
2016-11-24 19:59:51 +00:00
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
2016-12-05 15:25:19 +00:00
BASE_URL = 'https://theorangeone.net'
SITE_URL = BASE_URL
2016-12-15 22:00:42 +00:00
2016-12-17 22:22:16 +00:00
PASSWORD_REQUIRED_TEMPLATE = 'pages/password_required.html'