2015-02-09 15:03:45 +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
|
|
|
|
HOBO_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.
|
|
|
|
"""
|
2014-03-24 19:16:09 +01:00
|
|
|
|
|
|
|
import os
|
2021-05-14 18:39:27 +02:00
|
|
|
|
2015-02-09 15:03:45 +01:00
|
|
|
from django.conf import global_settings
|
2023-03-29 12:10:39 +02:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2015-02-09 15:03:45 +01:00
|
|
|
|
|
|
|
# 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.6/howto/deployment/checklist/
|
|
|
|
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
|
|
SECRET_KEY = 'hc^g)m7+*n+!8ej5i4*5iiv21s-y#+lpgje1w8d1jw5cyd+g%s'
|
|
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
|
|
DEBUG = True
|
|
|
|
|
|
|
|
ALLOWED_HOSTS = []
|
|
|
|
|
2019-04-18 09:33:34 +02:00
|
|
|
HOBO_VALIDATE_EMAIL_WITH_SMTP = True
|
2019-03-29 10:17:59 +01:00
|
|
|
ALLOWED_SPF_RECORDS = []
|
2022-12-12 10:54:57 +01:00
|
|
|
# EMAIL_FROM_ALLOWED_DOMAINS: list of allowed domains for default_from_email.
|
|
|
|
# Use ['*'] to allow all domains.
|
|
|
|
# Note: all get_operational_services() url domains are always allowed
|
|
|
|
EMAIL_FROM_ALLOWED_DOMAINS = []
|
2015-02-09 15:03:45 +01:00
|
|
|
|
|
|
|
# Application definition
|
|
|
|
|
|
|
|
INSTALLED_APPS = (
|
|
|
|
'django.contrib.admin',
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.messages',
|
|
|
|
'django.contrib.staticfiles',
|
2018-09-14 14:36:47 +02:00
|
|
|
'rest_framework',
|
2015-02-13 14:27:14 +01:00
|
|
|
'mellon',
|
2015-02-09 15:03:45 +01:00
|
|
|
'gadjo',
|
2022-10-18 17:38:31 +02:00
|
|
|
'sorl.thumbnail',
|
2022-01-08 16:07:08 +01:00
|
|
|
'hobo.applications',
|
2019-03-08 02:41:26 +01:00
|
|
|
'hobo.debug',
|
2015-02-09 15:03:45 +01:00
|
|
|
'hobo.environment',
|
2022-05-11 12:27:24 +02:00
|
|
|
'hobo.maintenance',
|
2019-03-18 20:02:26 +01:00
|
|
|
'hobo.matomo',
|
2015-05-07 14:37:00 +02:00
|
|
|
'hobo.profile',
|
2020-04-07 18:46:48 +02:00
|
|
|
'hobo.seo',
|
2015-12-27 11:23:33 +01:00
|
|
|
'hobo.theme',
|
2016-06-11 20:26:11 +02:00
|
|
|
'hobo.emails',
|
2015-05-08 10:25:19 +02:00
|
|
|
'hobo.deploy',
|
2020-09-16 16:48:49 +02:00
|
|
|
'hobo.sms',
|
2015-02-09 15:03:45 +01:00
|
|
|
)
|
|
|
|
|
2020-09-01 15:09:17 +02:00
|
|
|
MIDDLEWARE = (
|
2016-03-16 09:58:57 +01:00
|
|
|
'hobo.middleware.xforwardedfor.XForwardedForMiddleware',
|
2015-02-09 15:03:45 +01:00
|
|
|
'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',
|
2015-02-13 14:27:14 +01:00
|
|
|
'hobo.middleware.utils.StoreRequestMiddleware',
|
2015-02-09 15:03:45 +01:00
|
|
|
)
|
|
|
|
|
2018-01-01 12:03:56 +01:00
|
|
|
# Templates
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [
|
|
|
|
os.path.join(BASE_DIR, 'hobo', 'templates'),
|
|
|
|
],
|
|
|
|
'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.request',
|
|
|
|
'django.template.context_processors.static',
|
|
|
|
'django.template.context_processors.tz',
|
|
|
|
'django.contrib.messages.context_processors.messages',
|
|
|
|
'hobo.context_processors.template_vars',
|
|
|
|
'hobo.context_processors.hobo_json',
|
2022-11-17 15:15:32 +01:00
|
|
|
'publik_django_templatetags.wcs.context_processors.cards',
|
|
|
|
],
|
|
|
|
'builtins': [
|
|
|
|
'publik_django_templatetags.publik.templatetags.publik',
|
2018-01-01 12:03:56 +01:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
2015-03-16 15:33:13 +01:00
|
|
|
|
2015-02-09 15:03:45 +01:00
|
|
|
ROOT_URLCONF = 'hobo.urls'
|
|
|
|
|
|
|
|
WSGI_APPLICATION = 'hobo.wsgi.application'
|
|
|
|
|
|
|
|
|
|
|
|
# Database
|
|
|
|
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
|
|
|
|
|
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
|
|
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-29 14:35:49 +02:00
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
|
|
|
|
2015-02-09 15:03:45 +01:00
|
|
|
# Internationalization
|
|
|
|
# https://docs.djangoproject.com/en/1.6/topics/i18n/
|
|
|
|
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
|
|
# https://docs.djangoproject.com/en/1.6/howto/static-files/
|
|
|
|
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
|
|
|
|
2018-01-01 12:03:56 +01:00
|
|
|
STATICFILES_FINDERS = list(global_settings.STATICFILES_FINDERS) + ['gadjo.finders.XStaticFinder']
|
2015-02-09 15:03:45 +01:00
|
|
|
|
|
|
|
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'hobo', 'static'),)
|
|
|
|
|
2022-10-18 17:38:31 +02:00
|
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|
|
|
MEDIA_URL = '/media/'
|
|
|
|
|
|
|
|
# from solr.thumbnail -- https://sorl-thumbnail.readthedocs.io/en/latest/reference/settings.html
|
|
|
|
THUMBNAIL_PRESERVE_FORMAT = True
|
|
|
|
THUMBNAIL_FORCE_OVERWRITE = False
|
|
|
|
|
2015-02-09 15:03:45 +01:00
|
|
|
LOCALE_PATHS = (os.path.join(BASE_DIR, 'hobo', 'locale'),)
|
|
|
|
|
2015-02-13 18:42:16 +01:00
|
|
|
AUTHENTICATION_BACKENDS = (
|
|
|
|
'mellon.backends.SAMLBackend',
|
|
|
|
'django.contrib.auth.backends.ModelBackend',
|
|
|
|
)
|
|
|
|
|
2015-02-09 15:03:45 +01:00
|
|
|
# SERVICE_TEMPLATES: possible "flavours" for the various service types.
|
|
|
|
# This variable expects a dictionary mapping service identifiers
|
|
|
|
# to a list of (template name, template title) tuples.
|
|
|
|
#
|
|
|
|
# Note: Template names are opaque identifiers, it's up to the deployment
|
|
|
|
# agents to assign some meaning to them.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
# SERVICE_TEMPLATES = {
|
|
|
|
# 'wcs': [('export-auquo-light.wcs', u'Au quotidien light'),
|
|
|
|
# ('export-auquo.wcs', u'Au quotidien'),
|
|
|
|
# ('export-demo.wcs', u'Au quotidien Demo')],
|
|
|
|
# }
|
2016-01-04 10:34:27 +01:00
|
|
|
SERVICE_TEMPLATES = {
|
|
|
|
'combo': [
|
|
|
|
('', ''),
|
|
|
|
('portal-user', _('User Portal')),
|
|
|
|
('portal-agent', _('Agent Portal')),
|
|
|
|
]
|
|
|
|
}
|
2015-02-09 15:03:45 +01:00
|
|
|
|
|
|
|
# SERVICE_EXTRA_VARIABLES: variables to create automatically for the
|
2015-05-02 21:06:29 +02:00
|
|
|
# given service types; they can be simple strings, or a dictionary with
|
|
|
|
# name and label keys.
|
2015-02-09 15:03:45 +01:00
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
# SERVICE_EXTRA_VARIABLES = {
|
|
|
|
# 'wcs': ['legal_url', 'commune_url', 'domain_key'],
|
2015-05-02 21:06:29 +02:00
|
|
|
# 'combo': [{'name': 'theme', 'label': 'Theme'}],
|
2015-02-09 15:03:45 +01:00
|
|
|
# }
|
|
|
|
SERVICE_EXTRA_VARIABLES = None
|
|
|
|
|
2015-02-13 18:16:11 +01:00
|
|
|
# AMQP message broker (rabbitmq is recommended)
|
|
|
|
BROKER_URL = 'amqp://'
|
2015-02-13 23:02:51 +01:00
|
|
|
# Task expiry time, as seconds after task publish
|
|
|
|
# http://docs.celeryproject.org/en/latest/userguide/calling.html#expiration
|
2020-02-27 11:16:51 +01:00
|
|
|
BROKER_TASK_EXPIRES = 600
|
2015-02-09 15:03:45 +01:00
|
|
|
|
|
|
|
LOGIN_REDIRECT_URL = '/'
|
2015-02-13 18:42:16 +01:00
|
|
|
LOGIN_URL = '/login/'
|
|
|
|
LOGOUT_URL = '/logout/'
|
2015-02-09 15:03:45 +01:00
|
|
|
|
|
|
|
# mellon authentication params
|
2015-02-13 18:42:16 +01:00
|
|
|
MELLON_ADAPTER = ('hobo.utils.MellonAdapter',)
|
|
|
|
|
2015-02-09 15:03:45 +01:00
|
|
|
MELLON_ATTRIBUTE_MAPPING = {
|
|
|
|
'email': '{attributes[email][0]}',
|
|
|
|
'first_name': '{attributes[first_name][0]}',
|
|
|
|
'last_name': '{attributes[last_name][0]}',
|
|
|
|
}
|
2014-09-15 09:55:47 +02:00
|
|
|
|
2015-02-09 15:03:45 +01:00
|
|
|
MELLON_SUPERUSER_MAPPING = {
|
2015-02-13 18:42:16 +01:00
|
|
|
'is_superuser': 'true',
|
2015-02-09 15:03:45 +01:00
|
|
|
}
|
2014-09-15 09:55:47 +02:00
|
|
|
|
2018-03-07 16:39:43 +01:00
|
|
|
MELLON_ADD_AUTHNREQUEST_NEXT_URL_EXTENSION = True
|
|
|
|
|
2015-12-27 11:23:33 +01:00
|
|
|
THEMES_DIRECTORY = '/usr/share/publik/themes/'
|
|
|
|
|
2015-04-29 16:45:25 +02:00
|
|
|
MELLON_USERNAME_TEMPLATE = '{attributes[name_id_content]}'
|
2014-09-15 09:55:47 +02:00
|
|
|
|
2019-03-26 19:06:49 +01:00
|
|
|
# MATOMO_SERVER: allow automatic configuration on a matomo server.
|
|
|
|
# This variable excepts:
|
|
|
|
# - the URL of the matomo server to connect
|
|
|
|
# - an authentication token for a matomo admin user
|
|
|
|
# - an email template for new emails associated with new matomo users
|
|
|
|
# The token is available on the matomo GUI into the personal parameters
|
|
|
|
# of the user.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
# MATOMO_SERVER = {
|
|
|
|
# 'URL': 'https://matomo.domain.org',
|
|
|
|
# 'TOKEN_AUTH': '0123456789abcdef0123456789abcdef',
|
2022-07-24 11:15:38 +02:00
|
|
|
# 'EMAIL_TEMPLATE': 'noreply+%(user_login)s@domain.org'
|
2019-03-26 19:06:49 +01:00
|
|
|
# }
|
|
|
|
|
|
|
|
MATOMO_SERVER = {}
|
|
|
|
|
2022-12-13 11:04:21 +01:00
|
|
|
# List of service class names to hide from the create service menu.
|
|
|
|
HOBO_SERVICES_DISABLED = [
|
|
|
|
'bijoe',
|
|
|
|
'fargo',
|
|
|
|
'lingo',
|
|
|
|
'welco',
|
|
|
|
]
|
|
|
|
# List of service to show in the create service menu, it overrides HOBO_SERVICES_DISABLED.
|
|
|
|
HOBO_SERVICES_ENABLED = []
|
|
|
|
|
2015-02-09 15:03:45 +01:00
|
|
|
local_settings_file = os.environ.get(
|
|
|
|
'HOBO_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')
|
2021-05-14 18:39:27 +02:00
|
|
|
)
|
2015-02-09 15:03:45 +01:00
|
|
|
if os.path.exists(local_settings_file):
|
2022-02-18 17:25:30 +01:00
|
|
|
with open(local_settings_file) as f:
|
|
|
|
exec(f.read())
|