2014-12-30 10:54:09 +01:00
|
|
|
# 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/>.
|
2014-12-07 14:59:41 +01:00
|
|
|
|
2014-12-30 10:54:09 +01:00
|
|
|
"""
|
|
|
|
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).
|
2014-12-07 14:59:41 +01:00
|
|
|
|
2014-12-30 10:54:09 +01:00
|
|
|
The local settings file should exist, at least to set a suitable SECRET_KEY,
|
|
|
|
and to disable DEBUG mode in production.
|
2014-12-07 14:59:41 +01:00
|
|
|
"""
|
|
|
|
|
2018-12-27 09:44:21 +01:00
|
|
|
import copy
|
2014-12-07 14:59:41 +01:00
|
|
|
import os
|
2015-01-17 14:20:57 +01:00
|
|
|
from django.conf import global_settings
|
2016-02-09 09:45:20 +01:00
|
|
|
from django.utils.translation import ugettext_lazy as _
|
2014-12-07 14:59:41 +01:00
|
|
|
|
2014-12-30 10:54:09 +01:00
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
|
|
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
2014-12-07 14:59:41 +01:00
|
|
|
|
|
|
|
# Quick-start development settings - unsuitable for production
|
2015-01-03 00:39:11 +01:00
|
|
|
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
|
2014-12-07 14:59:41 +01:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
ALLOWED_HOSTS = []
|
|
|
|
|
|
|
|
|
|
|
|
# Application definition
|
|
|
|
|
|
|
|
INSTALLED_APPS = (
|
|
|
|
'django.contrib.admin',
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.messages',
|
|
|
|
'django.contrib.staticfiles',
|
2017-04-13 14:38:26 +02:00
|
|
|
'django.contrib.humanize',
|
2016-11-09 01:36:20 +01:00
|
|
|
'rest_framework',
|
2014-12-07 15:34:30 +01:00
|
|
|
'ckeditor',
|
2014-12-07 16:03:47 +01:00
|
|
|
'gadjo',
|
2017-05-15 14:10:06 +02:00
|
|
|
'sorl.thumbnail',
|
2014-12-07 15:34:30 +01:00
|
|
|
'combo.data',
|
2017-04-10 14:17:45 +02:00
|
|
|
'combo.profile',
|
2014-12-07 16:03:47 +01:00
|
|
|
'combo.manager',
|
2014-12-07 21:24:27 +01:00
|
|
|
'combo.public',
|
2018-06-12 08:35:35 +02:00
|
|
|
'combo.apps.assets',
|
2017-05-12 14:06:55 +02:00
|
|
|
'combo.apps.dashboard',
|
2015-05-20 19:11:37 +02:00
|
|
|
'combo.apps.wcs',
|
2015-05-26 17:14:53 +02:00
|
|
|
'combo.apps.publik',
|
2015-08-27 18:50:33 +02:00
|
|
|
'combo.apps.family',
|
2015-11-23 22:48:14 +01:00
|
|
|
'combo.apps.dataviz',
|
2015-12-25 21:15:43 +01:00
|
|
|
'combo.apps.lingo',
|
2016-05-17 18:09:52 +02:00
|
|
|
'combo.apps.momo',
|
2016-01-20 17:23:32 +01:00
|
|
|
'combo.apps.newsletters',
|
2016-02-12 19:25:02 +01:00
|
|
|
'combo.apps.fargo',
|
2016-11-09 01:36:20 +01:00
|
|
|
'combo.apps.notifications',
|
2017-02-22 16:15:37 +01:00
|
|
|
'combo.apps.search',
|
2016-03-30 14:45:16 +02:00
|
|
|
'combo.apps.usersearch',
|
2017-05-12 11:53:07 +02:00
|
|
|
'combo.apps.maps',
|
2017-05-17 18:19:07 +02:00
|
|
|
'combo.apps.calendar',
|
2018-06-10 10:02:54 +02:00
|
|
|
'combo.apps.pwa',
|
2015-05-25 12:59:41 +02:00
|
|
|
'combo.apps.gallery',
|
2017-03-17 08:53:22 +01:00
|
|
|
'haystack',
|
2017-10-18 10:46:34 +02:00
|
|
|
'xstatic.pkg.josefinsans',
|
2017-05-15 19:01:38 +02:00
|
|
|
'xstatic.pkg.leaflet',
|
2017-09-05 15:21:23 +02:00
|
|
|
'xstatic.pkg.opensans',
|
|
|
|
'xstatic.pkg.roboto_fontface',
|
2018-02-12 19:20:18 +01:00
|
|
|
'xstatic.pkg.leaflet_markercluster',
|
2014-12-07 14:59:41 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
MIDDLEWARE_CLASSES = (
|
2017-09-27 14:03:52 +02:00
|
|
|
'combo.middleware.GlobalRequestMiddleware',
|
2014-12-07 14:59:41 +01:00
|
|
|
'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',
|
|
|
|
)
|
|
|
|
|
2014-12-07 16:03:47 +01:00
|
|
|
# Serve xstatic files, required for gadjo
|
2017-09-09 13:41:51 +02:00
|
|
|
STATICFILES_FINDERS = list(global_settings.STATICFILES_FINDERS) + \
|
|
|
|
['gadjo.finders.XStaticFinder']
|
|
|
|
|
|
|
|
# Templates
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [
|
|
|
|
],
|
|
|
|
'APP_DIRS': True,
|
|
|
|
'OPTIONS': {
|
|
|
|
'context_processors': [
|
|
|
|
'django.contrib.auth.context_processors.auth',
|
|
|
|
'django.template.context_processors.debug',
|
|
|
|
'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',
|
|
|
|
'combo.context_processors.template_vars',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
2014-12-07 16:03:47 +01:00
|
|
|
|
2014-12-07 14:59:41 +01:00
|
|
|
ROOT_URLCONF = 'combo.urls'
|
|
|
|
|
|
|
|
WSGI_APPLICATION = 'combo.wsgi.application'
|
|
|
|
|
|
|
|
|
|
|
|
# Database
|
2015-01-03 00:39:11 +01:00
|
|
|
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
|
2014-12-07 14:59:41 +01:00
|
|
|
|
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
|
|
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Internationalization
|
2015-01-03 00:39:11 +01:00
|
|
|
# https://docs.djangoproject.com/en/1.7/topics/i18n/
|
2014-12-07 14:59:41 +01:00
|
|
|
|
2015-01-17 19:15:16 +01:00
|
|
|
LANGUAGE_CODE = 'fr-fr'
|
2014-12-07 14:59:41 +01:00
|
|
|
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
2015-01-17 19:15:16 +01:00
|
|
|
LOCALE_PATHS = (os.path.join(BASE_DIR, 'combo', 'locale'), )
|
2014-12-07 14:59:41 +01:00
|
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
2015-01-03 00:39:11 +01:00
|
|
|
# https://docs.djangoproject.com/en/1.7/howto/static-files/
|
2014-12-07 14:59:41 +01:00
|
|
|
|
|
|
|
STATIC_URL = '/static/'
|
2014-12-07 15:34:30 +01:00
|
|
|
|
2015-01-10 12:30:25 +01:00
|
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|
|
|
MEDIA_URL = '/media/'
|
|
|
|
|
2019-02-26 14:51:17 +01:00
|
|
|
# mode for newly updated files
|
|
|
|
FILE_UPLOAD_PERMISSIONS = 0o644
|
|
|
|
|
2015-01-10 12:30:25 +01:00
|
|
|
CKEDITOR_UPLOAD_PATH = 'uploads/'
|
2016-06-22 16:30:32 +02:00
|
|
|
CKEDITOR_IMAGE_BACKEND = 'pillow'
|
2015-06-06 16:16:19 +02:00
|
|
|
|
2015-01-03 15:41:36 +01:00
|
|
|
CKEDITOR_CONFIGS = {
|
|
|
|
'default': {
|
2016-01-15 19:02:19 +01:00
|
|
|
'allowedContent': True,
|
|
|
|
'removePlugins': 'stylesheetparser',
|
2015-01-03 15:41:36 +01:00
|
|
|
'toolbar_Own': [['Source', 'Format', '-', 'Bold', 'Italic'],
|
2015-01-17 14:32:42 +01:00
|
|
|
['NumberedList', 'BulletedList'],
|
2015-01-03 15:41:36 +01:00
|
|
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
|
|
|
['Link', 'Unlink'],
|
2016-11-11 14:31:32 +01:00
|
|
|
['Image', '-', 'HorizontalRule'],
|
2016-05-13 09:20:44 +02:00
|
|
|
['RemoveFormat',],
|
|
|
|
['Maximize']],
|
2015-01-03 15:41:36 +01:00
|
|
|
'toolbar': 'Own',
|
2016-05-16 10:31:01 +02:00
|
|
|
'resize_enabled': False,
|
2015-01-03 15:41:36 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2018-12-27 09:44:21 +01:00
|
|
|
CKEDITOR_CONFIGS['small'] = copy.copy(CKEDITOR_CONFIGS['default'])
|
|
|
|
CKEDITOR_CONFIGS['small']['height'] = 150
|
|
|
|
|
2015-06-06 16:16:19 +02:00
|
|
|
HAYSTACK_CONNECTIONS = {
|
|
|
|
'default': {
|
|
|
|
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
|
|
|
|
'PATH': os.path.join(BASE_DIR, 'whoosh_index'),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2018-11-16 15:40:20 +01:00
|
|
|
# from solr.thumbnail -- https://sorl-thumbnail.readthedocs.io/en/latest/reference/settings.html
|
|
|
|
THUMBNAIL_PRESERVE_FORMAT = True
|
2019-01-20 16:27:59 +01:00
|
|
|
THUMBNAIL_FORCE_OVERWRITE = False
|
2015-06-06 16:16:19 +02:00
|
|
|
|
2016-05-16 20:28:48 +02:00
|
|
|
COMBO_DEFAULT_PUBLIC_TEMPLATE = 'standard'
|
2014-12-08 10:20:23 +01:00
|
|
|
COMBO_PUBLIC_TEMPLATES = {
|
|
|
|
'standard': {
|
2016-03-05 13:56:56 +01:00
|
|
|
'name': _('One column'),
|
2014-12-08 10:37:26 +01:00
|
|
|
'template': 'combo/page_template.html',
|
2014-12-30 11:12:00 +01:00
|
|
|
},
|
|
|
|
'standard-sidebar': {
|
2016-03-05 13:56:56 +01:00
|
|
|
'name': _('One column + sidebar'),
|
2014-12-30 11:12:00 +01:00
|
|
|
'template': 'combo/page_template_sidebar.html',
|
2016-03-05 13:56:56 +01:00
|
|
|
},
|
|
|
|
'two-columns': {
|
|
|
|
'name': _('Two columns'),
|
|
|
|
'template': 'combo/page_template_2cols.html',
|
|
|
|
},
|
|
|
|
'two-columns-sidebar': {
|
|
|
|
'name': _('Two columns + sidebar'),
|
|
|
|
'template': 'combo/page_template_2cols_sidebar.html',
|
2017-10-13 10:34:02 +02:00
|
|
|
# get those labels into gettext catalog
|
2017-10-17 10:27:10 +02:00
|
|
|
'_': (_('Left column'), _('Right column')),
|
2014-12-30 11:12:00 +01:00
|
|
|
},
|
2018-03-09 11:12:11 +01:00
|
|
|
'homepage': {
|
|
|
|
'name': _('Home page'),
|
|
|
|
'template': 'combo/page_template_homepage.html',
|
|
|
|
# get those labels into gettext catalog
|
|
|
|
'_': (_('Top banner'), _('Middle column')),
|
|
|
|
},
|
2014-12-08 10:20:23 +01:00
|
|
|
}
|
2014-12-30 11:12:00 +01:00
|
|
|
|
2017-02-03 14:52:17 +01:00
|
|
|
# extra variables for templates
|
|
|
|
TEMPLATE_VARS = {}
|
|
|
|
|
2015-01-07 14:10:33 +01:00
|
|
|
# Authentication settings
|
2015-02-18 09:52:34 +01:00
|
|
|
try:
|
|
|
|
import mellon
|
|
|
|
except ImportError:
|
|
|
|
mellon = None
|
|
|
|
|
|
|
|
if mellon is not None:
|
2018-04-24 10:15:56 +02:00
|
|
|
INSTALLED_APPS += ('mellon',)
|
2015-02-18 09:52:34 +01:00
|
|
|
AUTHENTICATION_BACKENDS = (
|
|
|
|
'mellon.backends.SAMLBackend',
|
|
|
|
'django.contrib.auth.backends.ModelBackend',
|
|
|
|
)
|
2015-02-18 09:37:33 +01:00
|
|
|
|
2015-01-30 11:37:08 +01:00
|
|
|
LOGIN_URL = '/login/'
|
2015-01-07 14:10:33 +01:00
|
|
|
LOGIN_REDIRECT_URL = '/'
|
2015-01-30 11:37:08 +01:00
|
|
|
LOGOUT_URL = '/logout/'
|
2015-01-07 14:10:33 +01:00
|
|
|
|
|
|
|
MELLON_ATTRIBUTE_MAPPING = {
|
|
|
|
'email': '{attributes[email][0]}',
|
|
|
|
'first_name': '{attributes[first_name][0]}',
|
|
|
|
'last_name': '{attributes[last_name][0]}',
|
|
|
|
}
|
|
|
|
|
2015-02-18 08:35:17 +01:00
|
|
|
MELLON_SUPERUSER_MAPPING = {
|
|
|
|
'is_superuser': 'true',
|
|
|
|
}
|
2015-01-07 14:10:33 +01:00
|
|
|
|
2015-04-30 01:08:08 +02:00
|
|
|
MELLON_USERNAME_TEMPLATE = '{attributes[name_id_content]}'
|
2015-01-07 14:10:33 +01:00
|
|
|
|
2015-02-27 14:05:14 +01:00
|
|
|
MELLON_IDENTITY_PROVIDERS = []
|
|
|
|
|
2017-04-23 16:11:19 +02:00
|
|
|
# search services
|
|
|
|
COMBO_SEARCH_SERVICES = {}
|
|
|
|
|
2016-03-30 18:10:17 +02:00
|
|
|
# mapping of payment modes
|
|
|
|
LINGO_NO_ONLINE_PAYMENT_REASONS = {}
|
|
|
|
|
2017-04-02 13:31:16 +02:00
|
|
|
JSON_CELL_TYPES = {}
|
|
|
|
|
2017-04-10 14:17:45 +02:00
|
|
|
# page to redirect the first time the user logs in.
|
|
|
|
COMBO_INITIAL_LOGIN_PAGE_PATH = None
|
|
|
|
|
2017-04-12 10:03:32 +02:00
|
|
|
# page to redirect on the first visit, to suggest user to log in.
|
|
|
|
COMBO_WELCOME_PAGE_PATH = None
|
2016-03-30 18:10:17 +02:00
|
|
|
|
2017-05-12 14:06:55 +02:00
|
|
|
# dashboard support
|
|
|
|
COMBO_DASHBOARD_ENABLED = False
|
|
|
|
|
2017-10-10 15:58:32 +02:00
|
|
|
COMBO_DASHBOARD_NEW_TILE_POSITION = 'last'
|
|
|
|
|
2017-05-15 19:01:38 +02:00
|
|
|
# default position on maps
|
|
|
|
COMBO_MAP_DEFAULT_POSITION = {'lat': '48.83369263315934',
|
|
|
|
'lng': '2.3233688436448574'
|
|
|
|
}
|
|
|
|
|
2017-09-30 13:28:36 +02:00
|
|
|
# default map bounds
|
|
|
|
COMBO_MAP_MAX_BOUNDS = {
|
|
|
|
'corner1': {'lat': None, 'lng': None},
|
|
|
|
'corner2': {'lat': None, 'lng': None}
|
|
|
|
}
|
|
|
|
|
2017-05-15 19:01:38 +02:00
|
|
|
# default map tiles url
|
2019-05-17 09:53:06 +02:00
|
|
|
COMBO_MAP_TILE_URLTEMPLATE = 'https://tiles.entrouvert.org/hdm/{z}/{x}/{y}.png'
|
2017-05-15 19:01:38 +02:00
|
|
|
|
|
|
|
# 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>'
|
|
|
|
|
2018-03-21 11:54:11 +01:00
|
|
|
# send notifications about new invoices
|
|
|
|
LINGO_INVOICE_NOTIFICATIONS_ENABLED = True
|
|
|
|
|
2017-11-14 18:48:44 +01:00
|
|
|
# default delta, in days, for invoice remind notifications
|
|
|
|
LINGO_NEW_INVOICES_REMIND_DELTA = 7
|
|
|
|
|
2018-03-07 19:20:31 +01:00
|
|
|
# default site
|
|
|
|
SITE_BASE_URL = 'http://localhost'
|
|
|
|
|
2017-12-21 01:42:05 +01:00
|
|
|
# timeout used in python-requests call, in seconds
|
|
|
|
# we use 28s by default: timeout just before web server, which is usually 30s
|
|
|
|
REQUESTS_TIMEOUT = 28
|
|
|
|
|
2018-03-22 10:34:36 +01:00
|
|
|
# default duration of notifications (in days)
|
|
|
|
COMBO_DEFAULT_NOTIFICATION_DURATION = 3
|
|
|
|
|
2018-06-13 11:43:41 +02:00
|
|
|
# predefined slots for assets
|
|
|
|
# example: {'banner': {'label': 'Banner image'}}
|
|
|
|
COMBO_ASSET_SLOTS = {}
|
|
|
|
|
2018-06-25 20:23:59 +02:00
|
|
|
# dynamic slots created for wcs category/form cells
|
|
|
|
# example: {'picture': {'prefix': 'Picture'}}
|
2018-10-21 12:42:40 +02:00
|
|
|
WCS_CATEGORY_ASSET_SLOTS = {
|
|
|
|
'picture': {
|
|
|
|
'prefix': _('Picture'),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2018-06-25 20:23:59 +02:00
|
|
|
WCS_FORM_ASSET_SLOTS = {}
|
|
|
|
|
2018-11-26 17:14:05 +01:00
|
|
|
# PWA Settings
|
|
|
|
PWA_VAPID_PUBLIK_KEY = None
|
|
|
|
PWA_VAPID_PRIVATE_KEY = None
|
|
|
|
PWA_VAPID_CLAIMS = None
|
|
|
|
PWA_NOTIFICATION_BADGE_URL = None
|
|
|
|
PWA_NOTIFICATION_ICON_URL = None
|
|
|
|
|
|
|
|
|
2018-10-23 20:56:16 +02:00
|
|
|
# hide work-in-progress/experimental/broken/legacy/whatever cells for now
|
2018-02-13 11:02:57 +01:00
|
|
|
BOOKING_CALENDAR_CELL_ENABLED = False
|
2018-02-15 13:40:56 +01:00
|
|
|
NEWSLETTERS_CELL_ENABLED = False
|
2018-10-23 20:56:16 +02:00
|
|
|
USERSEARCH_CELL_ENABLED = False
|
2018-02-13 11:02:57 +01:00
|
|
|
|
2014-12-30 10:54:09 +01:00
|
|
|
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):
|
2018-07-25 14:28:05 +02:00
|
|
|
exec(open(local_settings_file).read())
|