-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
77 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,3 @@ | ||
""" | ||
Django settings for iogt project. | ||
Generated by 'django-admin startproject' using Django 3.1.7. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/3.1/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/3.1/ref/settings/ | ||
""" | ||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | ||
import os | ||
import re | ||
|
@@ -20,6 +9,7 @@ | |
from django.core.exceptions import ImproperlyConfigured | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
from iogt.patch import * # noqa: F401, F403 | ||
from iogt.settings.profanity_settings import ( # noqa: F401 | ||
COMMENTS_ALLOW_PROFANITIES, | ||
PROFANITIES_LIST | ||
|
@@ -28,79 +18,70 @@ | |
|
||
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
BASE_DIR = os.path.dirname(PROJECT_DIR) | ||
|
||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ | ||
|
||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = [ | ||
'home', | ||
'search', | ||
'iogt_users', | ||
'allauth', | ||
'allauth.account', | ||
'allauth.socialaccount', | ||
'comments', | ||
'common', | ||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.humanize', | ||
'django.contrib.messages', | ||
'django.contrib.sessions', | ||
'django.contrib.sites', | ||
'django.contrib.staticfiles', | ||
'django_comments', | ||
'django_comments_xtd', | ||
'django_filters', | ||
'drf_yasg', | ||
'generic_chooser', | ||
'health_check', | ||
'health_check.cache', | ||
'health_check.contrib.migrations', | ||
'health_check.db', | ||
'health_check.storage', | ||
'home', | ||
'interactive', | ||
'iogt_content_migration', | ||
'questionnaires', | ||
'iogt_users', | ||
'matomo', | ||
'messaging', | ||
'common', | ||
'modelcluster', | ||
'notifications', | ||
'django.contrib.humanize', | ||
'wagtail_localize', | ||
'wagtail_localize.locales', | ||
'questionnaires', | ||
'rest_framework', | ||
'rest_framework_simplejwt', | ||
'sass_processor', | ||
'search', | ||
'taggit', | ||
'translation_manager', | ||
'wagtail', | ||
'wagtail.admin', | ||
'wagtail.contrib.forms', | ||
'wagtail.contrib.modeladmin', | ||
'wagtail.contrib.redirects', | ||
'wagtail.embeds', | ||
'wagtail.sites', | ||
'wagtail.users', | ||
'wagtail.snippets', | ||
'wagtail.contrib.settings', | ||
'wagtail.documents', | ||
'wagtail.embeds', | ||
'wagtail.images', | ||
'wagtail.search', | ||
'wagtail.admin', | ||
'wagtail', | ||
'wagtail.contrib.modeladmin', | ||
'wagtail.sites', | ||
'wagtail.snippets', | ||
'wagtail.users', | ||
'wagtail_localize', | ||
'wagtail_localize.locales', | ||
'wagtail_transfer', | ||
'wagtailcache', | ||
'wagtailmenus', | ||
'wagtailmedia', | ||
'wagtailmarkdown', | ||
'wagtail_transfer', | ||
'wagtailmedia', | ||
'wagtailmenus', | ||
'wagtailsvg', | ||
'wagtail.contrib.settings', | ||
|
||
'django_comments_xtd', | ||
'django_comments', | ||
'modelcluster', | ||
'taggit', | ||
'allauth', | ||
'allauth.account', | ||
'allauth.socialaccount', | ||
'rest_framework', | ||
'sass_processor', | ||
'translation_manager', | ||
'health_check', | ||
'health_check.db', | ||
'health_check.cache', | ||
'health_check.storage', | ||
'health_check.contrib.migrations', | ||
'rest_framework_simplejwt', | ||
'django_filters', | ||
'drf_yasg', | ||
'webpush', | ||
'matomo', | ||
'generic_chooser', | ||
|
||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
'django.contrib.sites', | ||
|
||
'interactive', | ||
] | ||
|
||
# The order of middleware is very important. Take care when modifying this list. | ||
MIDDLEWARE = [ | ||
'wagtailcache.cache.UpdateCacheMiddleware', | ||
'django.middleware.security.SecurityMiddleware', | ||
|
@@ -154,9 +135,6 @@ | |
|
||
WSGI_APPLICATION = 'iogt.wsgi.application' | ||
|
||
# Database | ||
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
|
@@ -169,15 +147,12 @@ | |
'django.contrib.auth.backends.ModelBackend', | ||
'allauth.account.auth_backends.AuthenticationBackend' | ||
] | ||
|
||
AUTH_USER_MODEL = 'iogt_users.User' | ||
|
||
# Password validation | ||
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators | ||
|
||
AUTH_PASSWORD_VALIDATORS = [ | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | ||
'NAME': ( | ||
'django.contrib.auth.password_validation.UserAttributeSimilarityValidator' | ||
), | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | ||
|
@@ -188,21 +163,13 @@ | |
] | ||
|
||
# Internationalization | ||
# https://docs.djangoproject.com/en/3.1/topics/i18n/ | ||
|
||
LANGUAGE_CODE = 'en' | ||
|
||
TIME_ZONE = 'UTC' | ||
|
||
USE_I18N = True | ||
|
||
USE_L10N = True | ||
|
||
USE_TZ = True | ||
|
||
# Static files (CSS, JavaScript, Images) | ||
# https://docs.djangoproject.com/en/3.1/howto/static-files/ | ||
|
||
STATICFILES_FINDERS = [ | ||
'django.contrib.staticfiles.finders.FileSystemFinder', | ||
'django.contrib.staticfiles.finders.AppDirectoriesFinder', | ||
|
@@ -223,9 +190,6 @@ | |
|
||
SASS_PROCESSOR_ROOT = os.path.join(BASE_DIR, 'static') | ||
|
||
# Allauth settings (https://django-allauth.readthedocs.io/en/latest/configuration.html) | ||
# ACCOUNT_SIGNUP_FORM_CLASS = 'iogt_users.forms.AccountSignUpAdditionalFieldsForm' | ||
|
||
# Control the forms that django-allauth uses | ||
ACCOUNT_FORMS = { | ||
"login": "allauth.account.forms.LoginForm", | ||
|
@@ -238,22 +202,24 @@ | |
# Use our custom signup form | ||
"signup": "iogt_users.forms.AccountSignupForm", | ||
} | ||
# ACCOUNT_SIGNUP_FORM_CLASS = 'iogt_users.extra_forms.AccountSignUpAdditionalFieldsForm' | ||
|
||
# Wagtail settings | ||
|
||
WAGTAIL_SITE_NAME = "IoGT" | ||
ACCOUNT_ADAPTER = 'iogt_users.adapters.AccountAdapter' | ||
|
||
WAGTAIL_USER_EDIT_FORM = 'iogt_users.forms.WagtailAdminUserEditForm' | ||
WAGTAIL_USER_CREATION_FORM = 'iogt_users.forms.WagtailAdminUserCreateForm' | ||
WAGTAIL_USER_CUSTOM_FIELDS = ['display_name', 'first_name', 'last_name', 'email', 'terms_accepted'] | ||
WAGTAIL_USER_CUSTOM_FIELDS = [ | ||
'display_name', | ||
'first_name', | ||
'last_name', | ||
'email', | ||
'terms_accepted' | ||
] | ||
|
||
# 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 | ||
WAGTAILADMIN_BASE_URL = os.getenv('BASE_URL', '') | ||
|
||
# SITE ID | ||
SITE_ID = 1 | ||
|
||
# Comments | ||
|
@@ -266,9 +232,11 @@ | |
LOGIN_URL = 'account_login' | ||
WAGTAIL_FRONTEND_LOGIN_URL = LOGIN_URL | ||
|
||
# To help obfuscating comments before they are sent for confirmation. | ||
COMMENTS_XTD_SALT = (b"Timendi causa est nescire. " | ||
b"Aequam memento rebus in arduis servare mentem.") | ||
# To help obfuscating comments before they are sent for confirmation | ||
COMMENTS_XTD_SALT = ( | ||
b"Timendi causa est nescire. " | ||
b"Aequam memento rebus in arduis servare mentem." | ||
) | ||
|
||
# Source mail address used for notifications. | ||
COMMENTS_XTD_FROM_EMAIL = "[email protected]" | ||
|
@@ -294,7 +262,7 @@ | |
WAGTAIL_CONTENT_LANGUAGES = LANGUAGES = [ | ||
('ar', _('Arabic')), | ||
('bn', _('Bengali')), | ||
('ny', _('Chichewa')), # previously 'ch' | ||
('ny', _('Chichewa')), # previously 'ch' | ||
('prs', _('Dari')), | ||
('en', _('English')), | ||
('fa', _('Farsi')), | ||
|
@@ -313,7 +281,7 @@ | |
('pt', _('Portuguese')), | ||
('qu', _('Quechua')), | ||
('ru', _('Russian')), | ||
('sn', _('Shona')), # previously 'sho' | ||
('sn', _('Shona')), # previously 'sho' | ||
('si', _('Sinhala')), | ||
('es', _('Spanish')), | ||
('sw', _('Swahili')), | ||
|
@@ -466,8 +434,6 @@ | |
|
||
TRANSLATIONS_PROJECT_BASE_DIR = BASE_DIR | ||
|
||
from iogt.patch import * | ||
|
||
WAGTAILTRANSFER_LOOKUP_FIELDS = { | ||
'taggit.tag': ['slug'], | ||
'wagtailcore.locale': ['language_code'], | ||
|
@@ -520,7 +486,7 @@ | |
'TIMEOUT': CACHE_TIMEOUT, | ||
'KEY_PREFIX': f'{KEY_PREFIX}_default', | ||
}, | ||
# https://docs.wagtail.org/en/v3.0.3/advanced_topics/performance.html#caching-image-renditions | ||
# See 'Caching image renditions' in Wagtail docs | ||
'renditions': { | ||
'BACKEND': CACHE_BACKEND, | ||
'LOCATION': CACHE_LOCATION, | ||
|
@@ -549,7 +515,10 @@ | |
} | ||
|
||
COMMENTS_COMMUNITY_MODERATION = os.getenv('COMMENTS_COMMUNITY_MODERATION') == 'enable' | ||
COMMENT_MODERATION_CLASS = os.getenv('COMMENT_MODERATION_CLASS', 'comments.clients.AlwaysApproveModerator') | ||
COMMENT_MODERATION_CLASS = os.getenv( | ||
'COMMENT_MODERATION_CLASS', | ||
'comments.clients.AlwaysApproveModerator', | ||
) | ||
BLACKLISTED_WORDS = os.getenv('BLACKLISTED_WORDS', '').split(',') | ||
|
||
SUPERSET_BASE_URL = os.getenv('SUPERSET_BASE_URL') | ||
|
@@ -560,24 +529,24 @@ | |
PUSH_NOTIFICATION = os.getenv('PUSH_NOTIFICATION', 'disable') == 'enable' | ||
JQUERY = os.getenv('JQUERY', 'enable') == 'enable' | ||
|
||
DATA_UPLOAD_MAX_NUMBER_FIELDS = int(os.getenv('DATA_UPLOAD_MAX_NUMBER_FIELDS', '') or '1000') | ||
DATA_UPLOAD_MAX_NUMBER_FIELDS = int(os.getenv('DATA_UPLOAD_MAX_NUMBER_FIELDS', '1000')) | ||
|
||
# Matomo tracking server and site information | ||
|
||
MATOMO_ADDITIONAL_SITE_ID = int(os.getenv('MATOMO_ADDITIONAL_SITE_ID', '0')) | ||
MATOMO_CREATE_VISITOR_ID = os.getenv('MATOMO_CREATE_VISITOR_ID', 'disable') == 'enable' | ||
MATOMO_SERVER_URL = os.getenv('MATOMO_SERVER_URL', '') | ||
MATOMO_SITE_ID = int(os.getenv('MATOMO_SITE_ID', '') or '0') | ||
MATOMO_SITE_ID = int(os.getenv('MATOMO_SITE_ID', '0')) | ||
MATOMO_TRACKING = os.getenv('MATOMO_TRACKING', 'disable') == 'enable' | ||
|
||
# Width size options are 360, 750 | ||
IMAGE_SIZE_PRESET = int(os.getenv('IMAGE_SIZE_PRESET', '') or '360') | ||
IMAGE_SIZE_PRESET = int(os.getenv('IMAGE_SIZE_PRESET', '360')) | ||
|
||
# Default primary key field type introduced in Django 3.2 or later versions | ||
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field | ||
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' | ||
|
||
WAGTAILREDIRECTS_AUTO_CREATE = os.getenv('WAGTAILREDIRECTS_AUTO_CREATE', 'enable') == 'enable' | ||
WAGTAILREDIRECTS_AUTO_CREATE = ( | ||
os.getenv('WAGTAILREDIRECTS_AUTO_CREATE', 'enable') == 'enable' | ||
) | ||
WAGTAILSVG_UPLOAD_FOLDER = "media" | ||
|
||
DEFAULT_FROM_EMAIL = os.getenv("EMAIL_FROM", "IoGT <iogt@localhost>") | ||
|