Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
mpicms/config/settings/base.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
252 lines (219 sloc)
7.32 KB
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
""" | |
Base settings for mpicms project. | |
""" | |
import os | |
from django.utils.translation import gettext_lazy as _ | |
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |
APPS_DIR = os.path.join(ROOT_DIR, 'mpicms') | |
# GENERAL | |
# ------------------------------------------------------------------------------ | |
TIME_ZONE = 'Europe/Berlin' | |
LANGUAGE_CODE = 'en' | |
SITE_ID = 1 | |
USE_I18N = True | |
USE_L10N = True | |
USE_TZ = True | |
# DATABASES | |
# ------------------------------------------------------------------------------ | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.postgresql', | |
'NAME': 'mpicms', | |
'ATOMIC_REQUESTS': True, | |
} | |
} | |
# URLS | |
# ------------------------------------------------------------------------------ | |
ROOT_URLCONF = 'config.urls' | |
WSGI_APPLICATION = 'config.wsgi.application' | |
# APPS | |
# ------------------------------------------------------------------------------ | |
DJANGO_APPS = [ | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.sessions', | |
'django.contrib.sites', | |
'django.contrib.messages', | |
'django.contrib.staticfiles', | |
'django.contrib.humanize', | |
'django.contrib.admin', | |
"django.contrib.sitemaps", | |
] | |
THIRD_PARTY_APPS = [ | |
'wagtail.contrib.forms', | |
'wagtail.contrib.redirects', | |
'wagtail.embeds', | |
'wagtail.sites', | |
'wagtail.users', | |
'wagtail.snippets', | |
'wagtail.documents', | |
'wagtail.images', | |
'wagtail.search', | |
'wagtail.admin', | |
'wagtail.core', | |
'wagtail.contrib.postgres_search', | |
'wagtail.contrib.search_promotions', | |
'wagtail.contrib.table_block', | |
'wagtail.contrib.modeladmin', | |
'wagtail.api.v2', | |
'wagtail_modeltranslation', | |
'wagtail_modeltranslation.makemigrations', | |
'wagtail_modeltranslation.migrate', | |
'modelcluster', | |
'taggit', | |
'rest_framework', | |
'treebeard', | |
] | |
LOCAL_APPS = [ | |
'mpicms.base.apps.BaseAppConfig', | |
'mpicms.news.apps.NewsAppConfig', | |
'mpicms.personal.apps.PersonalAppConfig', | |
'mpicms.users.apps.UserAppConfig', | |
'mpicms.events.apps.EventAppConfig', | |
'mpicms.publications.apps.PublicationAppConfig', | |
] | |
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS | |
# MIGRATIONS | |
# ------------------------------------------------------------------------------ | |
MIGRATION_MODULES = { | |
'sites': 'mpicms.contrib.sites.migrations' | |
} | |
# AUTHENTICATION | |
# ------------------------------------------------------------------------------ | |
AUTHENTICATION_BACKENDS = [ | |
'django.contrib.auth.backends.ModelBackend', | |
] | |
# AUTH_USER_MODEL = 'users.User' | |
# LOGIN_REDIRECT_URL = 'users:redirect' | |
# LOGIN_URL = 'account_login' | |
# PASSWORDS | |
# ------------------------------------------------------------------------------ | |
PASSWORD_HASHERS = [ | |
'django.contrib.auth.hashers.PBKDF2PasswordHasher', | |
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher', | |
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher', | |
'django.contrib.auth.hashers.BCryptPasswordHasher', | |
] | |
AUTH_PASSWORD_VALIDATORS = [ | |
{ | |
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | |
}, | |
{ | |
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | |
}, | |
{ | |
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | |
}, | |
{ | |
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | |
}, | |
] | |
# MIDDLEWARE | |
# ------------------------------------------------------------------------------ | |
MIDDLEWARE = [ | |
'django.middleware.security.SecurityMiddleware', | |
'django.contrib.sessions.middleware.SessionMiddleware', | |
'django.middleware.locale.LocaleMiddleware', | |
'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', | |
] | |
# STATIC | |
# ------------------------------------------------------------------------------ | |
STATIC_ROOT = os.path.join(ROOT_DIR, 'staticfiles') | |
STATIC_URL = '/static/' | |
STATICFILES_DIRS = [ | |
os.path.join(APPS_DIR, 'static'), | |
] | |
STATICFILES_FINDERS = [ | |
'django.contrib.staticfiles.finders.FileSystemFinder', | |
'django.contrib.staticfiles.finders.AppDirectoriesFinder', | |
] | |
# MEDIA | |
# ------------------------------------------------------------------------------ | |
MEDIA_ROOT = os.path.join(APPS_DIR, 'media') | |
MEDIA_URL = '/media/' | |
# TEMPLATES | |
# ------------------------------------------------------------------------------ | |
TEMPLATES = [ | |
{ | |
'BACKEND': 'django.template.backends.django.DjangoTemplates', | |
'DIRS': [ | |
os.path.join(APPS_DIR, 'templates'), | |
], | |
'OPTIONS': { | |
'debug': False, | |
'loaders': [ | |
'django.template.loaders.filesystem.Loader', | |
'django.template.loaders.app_directories.Loader', | |
], | |
'context_processors': [ | |
'django.template.context_processors.debug', | |
'django.template.context_processors.request', | |
'django.contrib.auth.context_processors.auth', | |
'django.template.context_processors.i18n', | |
'django.template.context_processors.media', | |
'django.template.context_processors.static', | |
'django.template.context_processors.tz', | |
'django.contrib.messages.context_processors.messages', | |
], | |
}, | |
}, | |
] | |
# FIXTURES | |
# ------------------------------------------------------------------------------ | |
FIXTURE_DIRS = ( | |
os.path.join(APPS_DIR, 'fixtures'), | |
) | |
# SECURITY | |
# ------------------------------------------------------------------------------ | |
SESSION_COOKIE_HTTPONLY = True | |
SECURE_BROWSER_XSS_FILTER = True | |
X_FRAME_OPTIONS = 'DENY' | |
# ------------------------------------------------------------------------------ | |
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' | |
# https://docs.djangoproject.com/en/dev/ref/settings/#default-from-email | |
DEFAULT_FROM_EMAIL = 'MPI <info@molgen.mpg.de>' | |
# https://docs.djangoproject.com/en/dev/ref/settings/#server-email | |
SERVER_EMAIL = DEFAULT_FROM_EMAIL | |
# https://docs.djangoproject.com/en/dev/ref/settings/#email-subject-prefix | |
EMAIL_SUBJECT_PREFIX = '[Intranet]' | |
# ADMIN | |
# ------------------------------------------------------------------------------ | |
ADMIN_URL = 'admin/' | |
ADMINS = [ | |
("""Donald Buczek""", 'buczek@molgen.mpg.de'), | |
] | |
MANAGERS = ADMINS | |
# TRANSLATION | |
LANGUAGES = ( | |
('en', _('English')), | |
('de', _('German')), | |
) | |
MODELTRANSLATION_FALLBACK_LANGUAGES = ('en', 'de') | |
LOCALE_PATHS = [ | |
os.path.join(ROOT_DIR, 'locale'), | |
] | |
WAGTAILMODELTRANSLATION_TRANSLATE_SLUGS = False | |
WAGTAILMODELTRANSLATION_LOCALE_PICKER_DEFAULT = ('de', 'en') | |
# WAGTAIL | |
WAGTAIL_SITE_NAME = 'MPI CMS' | |
# WAGTAIL_USER_EDIT_FORM = 'mpicms.users.forms.CustomUserEditForm' | |
# WAGTAIL_USER_CREATION_FORM = 'mpicms.users.forms.CustomUserCreationForm' | |
# WAGTAIL_USER_CUSTOM_FIELDS = ['phone', 'office'] | |
WAGTAIL_USER_EDIT_FORM = 'users.forms.UserEditForm' | |
# SEARCH | |
WAGTAILSEARCH_BACKENDS = { | |
'default': { | |
'BACKEND': 'wagtail.contrib.postgres_search.backend', | |
} | |
} | |
# Documentation | |
DOCS_ROOT = os.path.join(ROOT_DIR, 'docs/_build/html') | |
# API | |
WAGTAILAPI_LIMIT_MAX = 50 | |
DATA_UPLOAD_MAX_NUMBER_FIELDS=None |