303 lines
8.2 KiB
Python
303 lines
8.2 KiB
Python
# combo - content management system
|
|
# Copyright (C) 2014 Entr'ouvert
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify it
|
|
# under the terms of the GNU Affero General Public License as published
|
|
# by the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
"""
|
|
Django settings file; it loads the default settings, and local settings
|
|
(from a local_settings.py file, or a configuration file set in the
|
|
COMBO_SETTINGS_FILE environment variable).
|
|
|
|
The local settings file should exist, at least to set a suitable SECRET_KEY,
|
|
and to disable DEBUG mode in production.
|
|
"""
|
|
|
|
import os
|
|
from django.conf import global_settings
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from . import plugins
|
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
SECRET_KEY = 'r^(w+o4*txe1=t+0w*w3*9%idij!yeq1#axpsi4%5*u#3u&)1t'
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = True
|
|
|
|
TEMPLATE_DEBUG = True
|
|
|
|
ALLOWED_HOSTS = []
|
|
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = (
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'django.contrib.humanize',
|
|
'rest_framework',
|
|
'ckeditor',
|
|
'gadjo',
|
|
'sorl.thumbnail',
|
|
'cmsplugin_blurp',
|
|
'combo.data',
|
|
'combo.profile',
|
|
'combo.manager',
|
|
'combo.public',
|
|
'combo.apps.dashboard',
|
|
'combo.apps.wcs',
|
|
'combo.apps.publik',
|
|
'combo.apps.family',
|
|
'combo.apps.dataviz',
|
|
'combo.apps.lingo',
|
|
'combo.apps.momo',
|
|
'combo.apps.newsletters',
|
|
'combo.apps.fargo',
|
|
'combo.apps.notifications',
|
|
'combo.apps.search',
|
|
'combo.apps.usersearch',
|
|
'combo.apps.maps',
|
|
'combo.apps.calendar',
|
|
'haystack',
|
|
'xstatic.pkg.chartnew_js',
|
|
'xstatic.pkg.leaflet',
|
|
)
|
|
|
|
INSTALLED_APPS = plugins.register_plugins_apps(INSTALLED_APPS)
|
|
|
|
MIDDLEWARE_CLASSES = (
|
|
'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',
|
|
)
|
|
|
|
# Serve xstatic files, required for gadjo
|
|
STATICFILES_FINDERS = global_settings.STATICFILES_FINDERS + \
|
|
('gadjo.finders.XStaticFinder',)
|
|
|
|
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + \
|
|
('combo.context_processors.template_vars',)
|
|
|
|
ROOT_URLCONF = 'combo.urls'
|
|
|
|
WSGI_APPLICATION = 'combo.wsgi.application'
|
|
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
|
}
|
|
}
|
|
|
|
# Internationalization
|
|
# https://docs.djangoproject.com/en/1.7/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'fr-fr'
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
|
|
|
USE_TZ = True
|
|
|
|
LOCALE_PATHS = (os.path.join(BASE_DIR, 'combo', 'locale'), )
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/1.7/howto/static-files/
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|
MEDIA_URL = '/media/'
|
|
|
|
CKEDITOR_UPLOAD_PATH = 'uploads/'
|
|
CKEDITOR_IMAGE_BACKEND = 'pillow'
|
|
|
|
CKEDITOR_CONFIGS = {
|
|
'default': {
|
|
'allowedContent': True,
|
|
'removePlugins': 'stylesheetparser',
|
|
'toolbar_Own': [['Source', 'Format', '-', 'Bold', 'Italic'],
|
|
['NumberedList', 'BulletedList'],
|
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
|
['Link', 'Unlink'],
|
|
['Image', '-', 'HorizontalRule'],
|
|
['RemoveFormat',],
|
|
['Maximize']],
|
|
'toolbar': 'Own',
|
|
'resize_enabled': False,
|
|
},
|
|
}
|
|
|
|
HAYSTACK_CONNECTIONS = {
|
|
'default': {
|
|
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
|
|
'PATH': os.path.join(BASE_DIR, 'whoosh_index'),
|
|
},
|
|
}
|
|
|
|
|
|
COMBO_DEFAULT_PUBLIC_TEMPLATE = 'standard'
|
|
COMBO_PUBLIC_TEMPLATES = {
|
|
'standard': {
|
|
'name': _('One column'),
|
|
'template': 'combo/page_template.html',
|
|
'placeholders': {
|
|
'content': {
|
|
'name': _('Content'),
|
|
},
|
|
'footer': {
|
|
'name': _('Footer'),
|
|
'acquired': True,
|
|
},
|
|
}
|
|
},
|
|
'standard-sidebar': {
|
|
'name': _('One column + sidebar'),
|
|
'template': 'combo/page_template_sidebar.html',
|
|
'placeholders': {
|
|
'content': {
|
|
'name': _('Content'),
|
|
},
|
|
'sidebar': {
|
|
'name': _('Sidebar'),
|
|
},
|
|
'footer': {
|
|
'name': _('Footer'),
|
|
'acquired': True,
|
|
},
|
|
}
|
|
},
|
|
'two-columns': {
|
|
'name': _('Two columns'),
|
|
'template': 'combo/page_template_2cols.html',
|
|
'placeholders': {
|
|
'content': {
|
|
'name': _('Left Column'),
|
|
},
|
|
'right': {
|
|
'name': _('Right Column'),
|
|
},
|
|
'footer': {
|
|
'name': _('Footer'),
|
|
'acquired': True,
|
|
},
|
|
}
|
|
},
|
|
'two-columns-sidebar': {
|
|
'name': _('Two columns + sidebar'),
|
|
'template': 'combo/page_template_2cols_sidebar.html',
|
|
'placeholders': {
|
|
'content': {
|
|
'name': _('Left Column'),
|
|
},
|
|
'right': {
|
|
'name': _('Right Column'),
|
|
},
|
|
'sidebar': {
|
|
'name': _('Sidebar'),
|
|
},
|
|
'footer': {
|
|
'name': _('Footer'),
|
|
'acquired': True,
|
|
},
|
|
}
|
|
},
|
|
}
|
|
|
|
# extra variables for templates
|
|
TEMPLATE_VARS = {}
|
|
|
|
# Authentication settings
|
|
try:
|
|
import mellon
|
|
except ImportError:
|
|
mellon = None
|
|
|
|
if mellon is not None:
|
|
AUTHENTICATION_BACKENDS = (
|
|
'mellon.backends.SAMLBackend',
|
|
'django.contrib.auth.backends.ModelBackend',
|
|
)
|
|
|
|
LOGIN_URL = '/login/'
|
|
LOGIN_REDIRECT_URL = '/'
|
|
LOGOUT_URL = '/logout/'
|
|
|
|
MELLON_ATTRIBUTE_MAPPING = {
|
|
'email': '{attributes[email][0]}',
|
|
'first_name': '{attributes[first_name][0]}',
|
|
'last_name': '{attributes[last_name][0]}',
|
|
}
|
|
|
|
MELLON_SUPERUSER_MAPPING = {
|
|
'is_superuser': 'true',
|
|
}
|
|
|
|
MELLON_USERNAME_TEMPLATE = '{attributes[name_id_content]}'
|
|
|
|
MELLON_IDENTITY_PROVIDERS = []
|
|
|
|
# search services
|
|
COMBO_SEARCH_SERVICES = {}
|
|
|
|
# mapping of payment modes
|
|
LINGO_NO_ONLINE_PAYMENT_REASONS = {}
|
|
|
|
JSON_CELL_TYPES = {}
|
|
|
|
# page to redirect the first time the user logs in.
|
|
COMBO_INITIAL_LOGIN_PAGE_PATH = None
|
|
|
|
# page to redirect on the first visit, to suggest user to log in.
|
|
COMBO_WELCOME_PAGE_PATH = None
|
|
|
|
# dashboard support
|
|
COMBO_DASHBOARD_ENABLED = False
|
|
|
|
# default position on maps
|
|
COMBO_MAP_DEFAULT_POSITION = {'lat': '48.83369263315934',
|
|
'lng': '2.3233688436448574'
|
|
}
|
|
|
|
# default map tiles url
|
|
COMBO_MAP_TILE_URLTEMPLATE = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
|
|
|
|
# default combo map attribution
|
|
COMBO_MAP_ATTRIBUTION = 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
|
|
|
|
local_settings_file = os.environ.get('COMBO_SETTINGS_FILE',
|
|
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
|
|
if os.path.exists(local_settings_file):
|
|
execfile(local_settings_file)
|