dynamicweb/dynamicweb/settings.py

326 lines
8.9 KiB
Python
Raw Normal View History

"""
Copyright 2015 ungleich.
"""
# -*- coding: utf-8 -*-
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import logging
import django.db.backends.postgresql_psycopg2
from django.utils.translation import ugettext_lazy as _
gettext = lambda s: s
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
ADMINS = (
('Nico Schottelius', 'nico.schottelius@ungleich.ch'),
)
SITE_ID = 1
APP_ROOT_ENDPOINT = "/"
LOGIN_URL = None
LOGOUT_URL = None
LOGIN_REDIRECT_URL = None
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'xlhyv_l5-z6e8_@q6)n0up1a0$5-aad7d)om2t8g$bi6*@q44i'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = [
".ungleich.ch",
"digital.glarus.ungleich.ch" ]
# Application definition
INSTALLED_APPS = (
'djangocms_admin_style',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'cms', # django CMS itself
'treebeard', # utilities for implementing a tree
'menus', # helper for model independent hierarchical website navigation
'sekizai', # for javascript and css management
#django-cms plugins
'djangocms_flash',
'djangocms_googlemap',
'djangocms_inherit',
'djangocms_link',
'djangocms_snippet',
'djangocms_teaser',
#django-filer
'cmsplugin_filer_file',
'cmsplugin_filer_folder',
'cmsplugin_filer_link',
'cmsplugin_filer_teaser',
'cmsplugin_filer_video',
# versioning
'reversion',
#ck-editor
'djangocms_text_ckeditor',
# djangocms-blog
'filer',
'easy_thumbnails',
'cmsplugin_filer_image',
'parler',
'taggit',
'taggit_autosuggest',
'django_select2',
'meta',
'meta_mixin',
'admin_enhancer',
'djangocms_blog',
'bootstrap3',
'compressor',
# ungleich
'ungleich',
'railshosting',
'digitalglarus',
)
MIDDLEWARE_CLASSES = (
'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',
'django.middleware.locale.LocaleMiddleware',
# django-cms middlewares
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
)
# 'django.middleware.security.SecurityMiddleware',
ROOT_URLCONF = 'dynamicweb.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'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 = 'dynamicweb.wsgi.application'
# Deprecated since version 1.8.
# callables take a request object as their argument and return a dictionary of
# items to be merged into the context.
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"django.core.context_processors.request",
'sekizai.context_processors.sekizai',
'cms.context_processors.cms_settings',
)
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),
)
CMS_TEMPLATES_DIR = {
1: os.path.join(TEMPLATE_DIRS[0], 'cms/ungleich.ch/'),
}
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'app',
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
LANGUAGES = (
('en-us', _('US English')),
)
LANGUAGE_CODE = 'en-us'
CMS_PLACEHOLDER_CONF = {
'logo_image': {
'name': 'Logo Image',
'plugins': ['FilerImagePlugin'],
'limits': {
'global': 1,
}
},
'page-title': {
'name': 'Page Title',
'plugins': ['TextPlugin'],
'default_plugins': [
{
'plugin_type': 'TextPlugin',
'values': {
'body': 'Page Title...'
}
}
],
'limits': {
'global': 1,
}
},
'page-subtitle': {
'name': 'Page Subtitle',
'inherit': 'page-title',
'default_plugins': [
{
'plugin_type': 'TextPlugin',
'values': {
'body': 'Page subtitle...'
}
}
],
},
'footer_copyright': {
'name': 'Copyright',
'inherit': 'page-title',
'default_plugins': [
{
'plugin_type': 'TextPlugin',
'values': {
'body': 'Copyright...'
}
}
],
}
}
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': 'unix:/tmp/memcached.sock',
}
}
try:
from dynamicweb.local.local_settings import *
except ImportError:
logging.warning("No local_settings file found.")
if not APP_ROOT_ENDPOINT.endswith('/'):
APP_ROOT += '/'
if LOGIN_URL is None:
LOGIN_URL = APP_ROOT_ENDPOINT + 'accounts/login/'
if LOGOUT_URL is None:
LOGOUT_URL = APP_ROOT_ENDPOINT + 'accounts/logout/'
if LOGIN_REDIRECT_URL is None:
LOGIN_REDIRECT_URL = APP_ROOT_ENDPOINT
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# Media files.
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = APP_ROOT_ENDPOINT + 'media/'
FILE_UPLOAD_PERMISSIONS = 0o644
# Templates confs
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, "templates"),
)
META_SITE_PROTOCOL = 'http'
META_USE_SITES = True
MIGRATION_MODULES = {
'cms': 'cms.migrations',
'filer': 'filer.migrations_django',
'menus': 'menus.migrations_django',
'djangocms_flash': 'djangocms_flash.migrations_django',
'djangocms_googlemap': 'djangocms_googlemap.migrations_django',
'djangocms_inherit': 'djangocms_inherit.migrations_django',
'djangocms_link': 'djangocms_link.migrations_django',
'djangocms_snippet': 'djangocms_snippet.migrations_django',
'djangocms_teaser': 'djangocms_teaser.migrations_django',
'djangocms_column': 'djangocms_column.migrations_django',
'djangocms_flash': 'djangocms_flash.migrations_django',
'djangocms_googlemap': 'djangocms_googlemap.migrations_django',
'djangocms_inherit': 'djangocms_inherit.migrations_django',
'djangocms_style': 'djangocms_style.migrations_django',
'cmsplugin_filer_image': 'cmsplugin_filer_image.migrations_django',
'cmsplugin_filer_file': 'cmsplugin_filer_file.migrations_django',
'cmsplugin_filer_folder': 'cmsplugin_filer_folder.migrations_django',
'cmsplugin_filer_link': 'cmsplugin_filer_link.migrations_django',
'cmsplugin_filer_teaser': 'cmsplugin_filer_teaser.migrations_django',
'cmsplugin_filer_utils': 'cmsplugin_filer_utils.migrations_django',
'cmsplugin_filer_video': 'cmsplugin_filer_video.migrations_django',
'djangocms_text_ckeditor': 'djangocms_text_ckeditor.migrations',
}
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)
COMPRESS_PRECOMPILERS = (
('text/less', 'lesscpy {infile}'),
)
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
)
# django-cms-text-ckeditor
TEXT_SAVE_IMAGE_FUNCTION='cmsplugin_filer_image.integrations.ckeditor.create_image_plugin'
TEXT_ADDITIONAL_TAGS = ('iframe',)
TEXT_ADDITIONAL_ATTRIBUTES = ('scrolling', 'allowfullscreen', 'frameborder')
USE_X_FORWARDED_HOST = True
try:
from .local.local_settings import *
except ImportError as e:
pass