224 lines
6.3 KiB
Python
224 lines
6.3 KiB
Python
"""
|
|
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.
|
|
"""
|
|
|
|
import os
|
|
from django.conf import global_settings
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
# 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 = []
|
|
|
|
HOBO_VALIDATE_EMAIL_WITH_SMTP = True
|
|
ALLOWED_SPF_RECORDS = []
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = (
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'rest_framework',
|
|
'mellon',
|
|
'gadjo',
|
|
'hobo.debug',
|
|
'hobo.environment',
|
|
'hobo.franceconnect',
|
|
'hobo.matomo',
|
|
'hobo.profile',
|
|
'hobo.theme',
|
|
'hobo.emails',
|
|
'hobo.deploy',
|
|
)
|
|
|
|
MIDDLEWARE_CLASSES = (
|
|
'hobo.middleware.xforwardedfor.XForwardedForMiddleware',
|
|
'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',
|
|
'hobo.middleware.utils.StoreRequestMiddleware',
|
|
)
|
|
|
|
# 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',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
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'),
|
|
}
|
|
}
|
|
|
|
# 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')
|
|
|
|
STATICFILES_FINDERS = list(global_settings.STATICFILES_FINDERS) + ['gadjo.finders.XStaticFinder']
|
|
|
|
STATICFILES_DIRS = (
|
|
os.path.join(BASE_DIR, 'hobo', 'static'),
|
|
)
|
|
|
|
LOCALE_PATHS = (
|
|
os.path.join(BASE_DIR, 'hobo', 'locale'),
|
|
)
|
|
|
|
AUTHENTICATION_BACKENDS = (
|
|
'mellon.backends.SAMLBackend',
|
|
'django.contrib.auth.backends.ModelBackend',
|
|
)
|
|
|
|
# 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')],
|
|
# }
|
|
SERVICE_TEMPLATES = {
|
|
'combo': [('', ''),
|
|
('portal-user', _('User Portal')),
|
|
('portal-agent', _('Agent Portal')),
|
|
]
|
|
}
|
|
|
|
# SERVICE_EXTRA_VARIABLES: variables to create automatically for the
|
|
# given service types; they can be simple strings, or a dictionary with
|
|
# name and label keys.
|
|
#
|
|
# Example:
|
|
# SERVICE_EXTRA_VARIABLES = {
|
|
# 'wcs': ['legal_url', 'commune_url', 'domain_key'],
|
|
# 'combo': [{'name': 'theme', 'label': 'Theme'}],
|
|
# }
|
|
SERVICE_EXTRA_VARIABLES = None
|
|
|
|
# AMQP message broker (rabbitmq is recommended)
|
|
BROKER_URL = 'amqp://'
|
|
# Task expiry time, as seconds after task publish
|
|
# http://docs.celeryproject.org/en/latest/userguide/calling.html#expiration
|
|
BROKER_TASK_EXPIRES = 120
|
|
|
|
LOGIN_REDIRECT_URL = '/'
|
|
LOGIN_URL = '/login/'
|
|
LOGOUT_URL = '/logout/'
|
|
|
|
# mellon authentication params
|
|
MELLON_ADAPTER = ('hobo.utils.MellonAdapter',)
|
|
|
|
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_ADD_AUTHNREQUEST_NEXT_URL_EXTENSION = True
|
|
|
|
THEMES_DIRECTORY = '/usr/share/publik/themes/'
|
|
|
|
VARIABLE_SETTINGS_DEFAULTS = {}
|
|
|
|
MELLON_USERNAME_TEMPLATE = '{attributes[name_id_content]}'
|
|
|
|
# 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',
|
|
# 'EMAIL_TEMPLATE': 'noreply+%s@domain.org'
|
|
# }
|
|
|
|
MATOMO_SERVER = {}
|
|
|
|
local_settings_file = os.environ.get('HOBO_SETTINGS_FILE',
|
|
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
|
|
if os.path.exists(local_settings_file):
|
|
exec(open(local_settings_file).read())
|