2017-02-09 12:20:21 +00:00
|
|
|
"""
|
2017-02-09 15:21:50 +00:00
|
|
|
Django settings for temp project.
|
2017-02-09 12:20:21 +00:00
|
|
|
|
2017-02-09 15:21:50 +00:00
|
|
|
Generated by 'django-admin startproject' using Django 1.10.5.
|
2017-02-09 12:20:21 +00:00
|
|
|
|
|
|
|
For more information on this file, see
|
2021-09-09 20:48:48 +00:00
|
|
|
https://docs.djangoproject.com/en/3.2/topics/settings/
|
2017-02-09 12:20:21 +00:00
|
|
|
|
|
|
|
For the full list of settings and their values, see
|
2021-09-09 20:48:48 +00:00
|
|
|
https://docs.djangoproject.com/en/3.2/ref/settings/
|
2017-02-09 12:20:21 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
2023-04-26 12:24:06 +00:00
|
|
|
import dj_database_url
|
|
|
|
|
2018-01-18 17:58:19 +00:00
|
|
|
# Build paths inside the project like this: os.path.join(PROJECT_DIR, ...)
|
|
|
|
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
BASE_DIR = os.path.dirname(PROJECT_DIR)
|
2017-02-09 12:20:21 +00:00
|
|
|
|
|
|
|
# Quick-start development settings - unsuitable for production
|
2021-09-09 20:48:48 +00:00
|
|
|
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
|
2017-02-09 15:21:50 +00:00
|
|
|
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
2022-07-26 03:19:52 +00:00
|
|
|
SECRET_KEY = "c6u0-9c!7nilj_ysatsda0(f@e_2mws2f!6m0n^o*4#*q#kzp)"
|
2017-02-09 15:21:50 +00:00
|
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
|
|
DEBUG = True
|
|
|
|
|
|
|
|
ALLOWED_HOSTS = []
|
2017-02-09 12:20:21 +00:00
|
|
|
|
2024-06-12 11:41:48 +00:00
|
|
|
# Uncomment (and adjust as appropriate) to enable django-debug-toolbar
|
2021-07-20 11:19:10 +00:00
|
|
|
# INTERNAL_IPS = [
|
|
|
|
# '127.0.0.1',
|
|
|
|
# ]
|
2017-02-09 12:20:21 +00:00
|
|
|
|
|
|
|
# Application definition
|
|
|
|
|
|
|
|
INSTALLED_APPS = [
|
2022-07-26 03:19:52 +00:00
|
|
|
"bakerydemo.base",
|
|
|
|
"bakerydemo.blog",
|
|
|
|
"bakerydemo.breads",
|
|
|
|
"bakerydemo.locations",
|
2022-12-14 14:25:24 +00:00
|
|
|
"bakerydemo.recipes",
|
2022-07-26 03:19:52 +00:00
|
|
|
"bakerydemo.search",
|
|
|
|
"wagtail.embeds",
|
|
|
|
"wagtail.sites",
|
|
|
|
"wagtail.users",
|
|
|
|
"wagtail.snippets",
|
|
|
|
"wagtail.documents",
|
|
|
|
"wagtail.images",
|
|
|
|
"wagtail.search",
|
|
|
|
"wagtail.admin",
|
|
|
|
"wagtail.api.v2",
|
|
|
|
"wagtail.locales",
|
2023-06-22 15:38:38 +00:00
|
|
|
"wagtail.contrib.forms",
|
|
|
|
"wagtail.contrib.redirects",
|
|
|
|
"wagtail.contrib.routable_page",
|
2022-12-14 19:34:21 +00:00
|
|
|
"wagtail.contrib.table_block",
|
2022-11-17 15:26:32 +00:00
|
|
|
"wagtail.contrib.typed_table_block",
|
2023-06-22 15:38:38 +00:00
|
|
|
"wagtail.contrib.search_promotions",
|
|
|
|
"wagtail.contrib.settings",
|
2022-07-26 03:19:52 +00:00
|
|
|
"wagtail.contrib.simple_translation",
|
|
|
|
"wagtail.contrib.styleguide",
|
|
|
|
"wagtail",
|
|
|
|
"rest_framework",
|
|
|
|
"modelcluster",
|
|
|
|
"taggit",
|
2023-01-27 16:56:55 +00:00
|
|
|
"wagtailfontawesomesvg",
|
2024-06-12 11:41:48 +00:00
|
|
|
# Uncomment to enable django-debug-toolbar
|
|
|
|
# "debug_toolbar",
|
2023-03-23 14:48:45 +00:00
|
|
|
"django_extensions",
|
2022-07-26 03:19:52 +00:00
|
|
|
"django.contrib.admin",
|
|
|
|
"django.contrib.auth",
|
|
|
|
"django.contrib.contenttypes",
|
|
|
|
"django.contrib.sessions",
|
|
|
|
"django.contrib.messages",
|
|
|
|
"django.contrib.staticfiles",
|
|
|
|
"django.contrib.sitemaps",
|
2017-02-09 12:20:21 +00:00
|
|
|
]
|
|
|
|
|
2017-02-09 15:21:50 +00:00
|
|
|
MIDDLEWARE = [
|
2024-06-12 11:41:48 +00:00
|
|
|
# Uncomment to enable django-debug-toolbar
|
|
|
|
# "debug_toolbar.middleware.DebugToolbarMiddleware",
|
2022-07-26 03:19:52 +00:00
|
|
|
"django.middleware.security.SecurityMiddleware",
|
|
|
|
"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",
|
|
|
|
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
|
2017-02-09 12:20:21 +00:00
|
|
|
]
|
|
|
|
|
2021-07-16 18:48:38 +00:00
|
|
|
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
|
2022-07-26 03:19:52 +00:00
|
|
|
ROOT_URLCONF = "bakerydemo.urls"
|
2017-02-09 12:20:21 +00:00
|
|
|
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
2022-07-26 03:19:52 +00:00
|
|
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
|
|
"DIRS": [
|
|
|
|
"bakerydemo/templates",
|
|
|
|
],
|
|
|
|
"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",
|
2023-06-22 15:38:38 +00:00
|
|
|
"wagtail.contrib.settings.context_processors.settings",
|
2017-02-09 12:20:21 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2022-07-26 03:19:52 +00:00
|
|
|
WSGI_APPLICATION = "bakerydemo.wsgi.application"
|
2017-02-09 12:20:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Database
|
2021-09-09 20:48:48 +00:00
|
|
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
2017-02-09 12:20:21 +00:00
|
|
|
|
2023-04-26 12:02:46 +00:00
|
|
|
if "DATABASE_URL" in os.environ:
|
2023-04-26 12:18:06 +00:00
|
|
|
DATABASES = {"default": dj_database_url.config(conn_max_age=500)}
|
2023-04-26 12:02:46 +00:00
|
|
|
else:
|
|
|
|
DATABASES = {
|
|
|
|
"default": {
|
|
|
|
"ENGINE": "django.db.backends.sqlite3",
|
|
|
|
"NAME": os.path.join(BASE_DIR, "bakerydemodb"),
|
|
|
|
}
|
2017-02-09 12:20:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Password validation
|
2021-09-09 20:48:48 +00:00
|
|
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
|
2017-02-09 12:20:21 +00:00
|
|
|
|
|
|
|
AUTH_PASSWORD_VALIDATORS = [
|
|
|
|
{
|
2022-07-26 03:19:52 +00:00
|
|
|
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
2017-02-09 12:20:21 +00:00
|
|
|
},
|
|
|
|
{
|
2022-07-26 03:19:52 +00:00
|
|
|
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
2017-02-09 12:20:21 +00:00
|
|
|
},
|
|
|
|
{
|
2022-07-26 03:19:52 +00:00
|
|
|
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
2017-02-09 12:20:21 +00:00
|
|
|
},
|
|
|
|
{
|
2022-07-26 03:19:52 +00:00
|
|
|
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
2017-02-09 12:20:21 +00:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
# Internationalization
|
2021-09-09 20:48:48 +00:00
|
|
|
# https://docs.djangoproject.com/en/3.2/topics/i18n/
|
2017-02-09 12:20:21 +00:00
|
|
|
|
2022-07-26 03:19:52 +00:00
|
|
|
LANGUAGE_CODE = "en-us"
|
2017-02-09 12:20:21 +00:00
|
|
|
|
2022-07-26 03:19:52 +00:00
|
|
|
TIME_ZONE = "UTC"
|
2017-02-09 12:20:21 +00:00
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
2021-09-09 20:48:48 +00:00
|
|
|
# https://docs.djangoproject.com/en/3.2/howto/static-files/
|
2017-02-09 12:20:21 +00:00
|
|
|
|
|
|
|
STATICFILES_FINDERS = [
|
2022-07-26 03:19:52 +00:00
|
|
|
"django.contrib.staticfiles.finders.FileSystemFinder",
|
|
|
|
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
|
2017-02-09 12:20:21 +00:00
|
|
|
]
|
|
|
|
|
2017-02-10 09:48:08 +00:00
|
|
|
STATICFILES_DIRS = [
|
2022-07-26 03:19:52 +00:00
|
|
|
os.path.join(PROJECT_DIR, "static"),
|
2017-02-10 09:48:08 +00:00
|
|
|
]
|
2017-02-09 12:20:21 +00:00
|
|
|
|
2022-07-26 03:19:52 +00:00
|
|
|
STATIC_ROOT = os.path.join(PROJECT_DIR, "collect_static")
|
|
|
|
STATIC_URL = "/static/"
|
2017-02-09 12:20:21 +00:00
|
|
|
|
2022-07-26 03:19:52 +00:00
|
|
|
MEDIA_ROOT = os.path.join(PROJECT_DIR, "media")
|
|
|
|
MEDIA_URL = "/media/"
|
2017-02-09 12:20:21 +00:00
|
|
|
|
2017-03-15 06:54:42 +00:00
|
|
|
# Override in local settings or replace with your own key. Please don't use our demo key in production!
|
2022-07-26 03:19:52 +00:00
|
|
|
GOOGLE_MAP_API_KEY = "AIzaSyD31CT9P9KxvNUJOwDq2kcFEIG8ADgaFgw"
|
2017-03-15 06:54:42 +00:00
|
|
|
|
2017-02-09 12:20:21 +00:00
|
|
|
# Use Elasticsearch as the search backend for extra performance and better search results
|
|
|
|
WAGTAILSEARCH_BACKENDS = {
|
2022-07-26 03:19:52 +00:00
|
|
|
"default": {
|
|
|
|
"BACKEND": "wagtail.search.backends.database",
|
|
|
|
"INDEX": "bakerydemo",
|
2017-02-09 12:20:21 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
# Wagtail settings
|
|
|
|
WAGTAIL_SITE_NAME = "bakerydemo"
|
2022-04-11 15:58:16 +00:00
|
|
|
|
|
|
|
WAGTAIL_I18N_ENABLED = True
|
|
|
|
|
|
|
|
WAGTAIL_CONTENT_LANGUAGES = LANGUAGES = [
|
|
|
|
("en", "English"),
|
|
|
|
("de", "Deutsch"),
|
|
|
|
("ar", "العربيّة"),
|
|
|
|
]
|
2023-02-03 10:03:58 +00:00
|
|
|
|
2023-11-14 15:14:07 +00:00
|
|
|
WAGTAILIMAGES_AVIF_QUALITY = 60
|
|
|
|
|
2023-02-03 10:03:58 +00:00
|
|
|
ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "changeme")
|
2023-06-30 12:46:09 +00:00
|
|
|
|
|
|
|
# Content Security policy settings
|
|
|
|
# http://django-csp.readthedocs.io/en/latest/configuration.html
|
|
|
|
|
|
|
|
# Only enable CSP when enabled through environment variables.
|
|
|
|
if "CSP_DEFAULT_SRC" in os.environ:
|
|
|
|
MIDDLEWARE.append("csp.middleware.CSPMiddleware")
|
|
|
|
|
|
|
|
# Only report violations, don't enforce policy
|
|
|
|
CSP_REPORT_ONLY = True
|
|
|
|
|
|
|
|
# The “special” source values of 'self', 'unsafe-inline', 'unsafe-eval', and 'none' must be quoted!
|
|
|
|
# e.g.: CSP_DEFAULT_SRC = "'self'" Without quotes they will not work as intended.
|
|
|
|
|
|
|
|
CSP_DEFAULT_SRC = os.environ.get("CSP_DEFAULT_SRC").split(",")
|
|
|
|
if "CSP_SCRIPT_SRC" in os.environ:
|
|
|
|
CSP_SCRIPT_SRC = os.environ.get("CSP_SCRIPT_SRC").split(",")
|
|
|
|
if "CSP_STYLE_SRC" in os.environ:
|
|
|
|
CSP_STYLE_SRC = os.environ.get("CSP_STYLE_SRC").split(",")
|
|
|
|
if "CSP_IMG_SRC" in os.environ:
|
|
|
|
CSP_IMG_SRC = os.environ.get("CSP_IMG_SRC").split(",")
|
|
|
|
if "CSP_CONNECT_SRC" in os.environ:
|
|
|
|
CSP_CONNECT_SRC = os.environ.get("CSP_CONNECT_SRC").split(",")
|
|
|
|
if "CSP_FONT_SRC" in os.environ:
|
|
|
|
CSP_FONT_SRC = os.environ.get("CSP_FONT_SRC").split(",")
|
|
|
|
if "CSP_BASE_URI" in os.environ:
|
|
|
|
CSP_BASE_URI = os.environ.get("CSP_BASE_URI").split(",")
|
|
|
|
if "CSP_OBJECT_SRC" in os.environ:
|
|
|
|
CSP_OBJECT_SRC = os.environ.get("CSP_OBJECT_SRC").split(",")
|