210 lines
5.2 KiB
Python
210 lines
5.2 KiB
Python
"""
|
|
Django settings for publichealth project.
|
|
|
|
Generated by 'django-admin startproject' using Django 1.8.2.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/1.8/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/1.8/ref/settings/
|
|
"""
|
|
|
|
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
|
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
import os
|
|
|
|
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
BASE_DIR = os.path.dirname(PROJECT_DIR)
|
|
|
|
# Project custom settings
|
|
|
|
NEWS_ENTRIES_HOME_PAGE = 2
|
|
BLOG_ENTRIES_HOME_PAGE = 3
|
|
|
|
STREAMS_ON_HOME_PAGE = [
|
|
{ 'name': 'News', 'link': 'top-news', 'icon': 'glyphicon-eye-open' },
|
|
{ 'name': 'Events', 'link': 'top-events', 'icon': 'glyphicon-time' },
|
|
{ 'name': 'Jobs', 'link': 'top-jobs', 'icon': 'glyphicon-briefcase' },
|
|
]
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'publichealth.home',
|
|
'publichealth.home.templatetags',
|
|
'publichealth.search',
|
|
|
|
'wagtail.contrib.routable_page',
|
|
'wagtail.contrib.sitemaps',
|
|
'wagtail.contrib.modeladmin',
|
|
'wagtail.contrib.settings',
|
|
'wagtail.contrib.forms',
|
|
'wagtail.contrib.redirects',
|
|
'wagtail.contrib.search_promotions',
|
|
"wagtail.contrib.legacy.richtext",
|
|
'wagtail.contrib.table_block',
|
|
|
|
'wagtail.embeds',
|
|
'wagtail.sites',
|
|
'wagtail.users',
|
|
'wagtail.snippets',
|
|
'wagtail.documents',
|
|
'wagtail.images',
|
|
'wagtail.search',
|
|
'wagtail.admin',
|
|
'wagtail.core',
|
|
|
|
'wagtail.api.v2',
|
|
'rest_framework',
|
|
'crispy_forms', # required by rest_framework
|
|
|
|
'modelcluster',
|
|
'compressor',
|
|
'taggit',
|
|
'puput',
|
|
'anymail',
|
|
'feedler',
|
|
'colorful',
|
|
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'django_social_share'
|
|
]
|
|
|
|
MIDDLEWARE = [
|
|
'django.middleware.security.SecurityMiddleware',
|
|
'whitenoise.middleware.WhiteNoiseMiddleware',
|
|
|
|
'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',
|
|
|
|
'django.middleware.locale.LocaleMiddleware',
|
|
|
|
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
|
|
]
|
|
|
|
ROOT_URLCONF = 'publichealth.urls'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [
|
|
os.path.join(PROJECT_DIR, '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',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = 'publichealth.wsgi.application'
|
|
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
'NAME': 'publichealth',
|
|
}
|
|
}
|
|
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
|
|
|
|
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',
|
|
},
|
|
]
|
|
|
|
PASSWORD_REQUIRED_TEMPLATE = 'password.html'
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/1.8/topics/i18n/
|
|
|
|
LANGUAGES = (
|
|
('de', u'Deutsch'),
|
|
('fr', u'Français'),
|
|
('en', u'English'),
|
|
)
|
|
LANGUAGE_CODE = 'de' # default language
|
|
|
|
TIME_ZONE = 'Europe/Zurich'
|
|
|
|
USE_I18N = True
|
|
USE_L10N = True
|
|
USE_TZ = True
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/1.8/howto/static-files/
|
|
|
|
STATICFILES_FINDERS = [
|
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
|
'compressor.finders.CompressorFinder',
|
|
]
|
|
|
|
STATICFILES_DIRS = [
|
|
os.path.join(PROJECT_DIR, 'static'),
|
|
]
|
|
|
|
# Whitenoise compression and caching support
|
|
# http://whitenoise.evans.io/en/stable/django.html
|
|
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
|
|
|
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
|
STATIC_URL = '/static/'
|
|
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|
MEDIA_URL = '/media/'
|
|
|
|
|
|
# Django compressor settings
|
|
# http://django-compressor.readthedocs.org/en/latest/settings/
|
|
|
|
COMPRESS_PRECOMPILERS = [
|
|
('text/x-scss', 'django_libsass.SassCompiler'),
|
|
]
|
|
|
|
# Wagtail settings
|
|
|
|
WAGTAIL_SITE_NAME = "Public Health Schweiz"
|
|
|
|
WAGTAILADMIN_RICH_TEXT_EDITORS = {
|
|
'default': {
|
|
'WIDGET': 'wagtail.admin.rich_text.HalloRichTextArea'
|
|
}
|
|
}
|
|
|
|
# Puput settings
|
|
|
|
PUPUT_AS_PLUGIN = True
|