2015-02-10 13:06:55 +01:00
|
|
|
# Django default settings for passerelle project.
|
2013-02-11 11:03:10 +01:00
|
|
|
|
2015-02-10 13:06:55 +01:00
|
|
|
from django.conf import global_settings
|
2014-10-02 09:54:39 +02:00
|
|
|
import os
|
|
|
|
import logging
|
2015-04-02 17:41:25 +02:00
|
|
|
|
2015-02-10 13:06:55 +01:00
|
|
|
try:
|
|
|
|
from logging.handlers import NullHandler
|
|
|
|
except ImportError:
|
|
|
|
# python < 2.7
|
|
|
|
class NullHandler(logging.Handler):
|
|
|
|
def emit(self, record):
|
|
|
|
pass
|
2014-09-02 15:16:25 +02:00
|
|
|
|
2015-02-10 13:06:55 +01:00
|
|
|
logging.getLogger('passerelle').addHandler(NullHandler())
|
2014-09-01 15:14:29 +02:00
|
|
|
|
2015-09-10 12:21:42 +02:00
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
|
|
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
2015-02-10 13:06:55 +01:00
|
|
|
|
|
|
|
### Quick-start development settings - unsuitable for production
|
|
|
|
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/
|
|
|
|
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
|
|
SECRET_KEY = 'please-change-me-with-a-very-long-random-string'
|
|
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
|
|
DEBUG = True
|
|
|
|
|
|
|
|
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
|
|
|
|
ALLOWED_HOSTS = []
|
|
|
|
|
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
2020-05-05 15:29:43 +02:00
|
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
2015-02-10 13:06:55 +01:00
|
|
|
'NAME': 'passerelle.sqlite3',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
### End of "Quick-start development settings"
|
|
|
|
|
|
|
|
|
|
|
|
# If you set this to False, Django will not format dates, numbers and
|
|
|
|
# calendars according to the current locale.
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
# If you set this to False, Django will not use timezone-aware datetimes.
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
|
|
|
# trailing slash.
|
|
|
|
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
|
|
|
|
MEDIA_URL = '/media/'
|
|
|
|
|
2019-02-26 14:51:50 +01:00
|
|
|
# mode for newly updated files
|
|
|
|
FILE_UPLOAD_PERMISSIONS = 0o644
|
|
|
|
|
2015-02-10 13:06:55 +01:00
|
|
|
# URL prefix for static files.
|
|
|
|
# Example: "http://media.lawrence.com/static/"
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
|
|
|
|
# Additional locations of static files
|
2015-09-10 12:21:42 +02:00
|
|
|
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'passerelle', 'static'),)
|
2015-02-10 13:06:55 +01:00
|
|
|
|
|
|
|
# List of finder classes that know how to find static files in
|
|
|
|
# various locations.
|
2017-10-25 23:49:19 +02:00
|
|
|
STATICFILES_FINDERS = list(global_settings.STATICFILES_FINDERS) + \
|
|
|
|
['gadjo.finders.XStaticFinder']
|
2015-02-10 13:06:55 +01:00
|
|
|
|
2019-11-25 13:49:10 +01:00
|
|
|
MIDDLEWARE = (
|
2015-02-10 13:06:55 +01:00
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
'django.middleware.locale.LocaleMiddleware',
|
2019-11-22 11:32:36 +01:00
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
2015-02-10 13:06:55 +01:00
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
2015-09-10 12:21:42 +02:00
|
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
2019-11-25 13:49:10 +01:00
|
|
|
)
|
2015-02-10 13:06:55 +01:00
|
|
|
|
|
|
|
ROOT_URLCONF = 'passerelle.urls'
|
|
|
|
|
|
|
|
# Python dotted path to the WSGI application used by Django's runserver.
|
|
|
|
WSGI_APPLICATION = 'passerelle.wsgi.application'
|
|
|
|
|
2015-09-10 12:21:42 +02:00
|
|
|
LOCALE_PATHS = (os.path.join(BASE_DIR, 'passerelle', 'locale'),)
|
2015-02-10 13:06:55 +01:00
|
|
|
LANGUAGE_CODE = 'fr-fr'
|
|
|
|
|
2017-10-25 23:49:19 +02:00
|
|
|
# Templates
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [
|
|
|
|
os.path.join(BASE_DIR, 'passerelle', '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.static',
|
|
|
|
'django.template.context_processors.tz',
|
|
|
|
'django.contrib.messages.context_processors.messages',
|
|
|
|
'django.template.context_processors.request',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
2015-02-10 13:06:55 +01:00
|
|
|
|
|
|
|
INSTALLED_APPS = (
|
|
|
|
# system apps
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.messages',
|
|
|
|
'django.contrib.staticfiles',
|
|
|
|
'django.contrib.admin',
|
2020-04-07 16:38:26 +02:00
|
|
|
'django.contrib.postgres',
|
2019-02-20 11:56:58 +01:00
|
|
|
# base app
|
2015-02-10 13:06:55 +01:00
|
|
|
'passerelle.base',
|
2020-05-02 19:42:40 +02:00
|
|
|
'passerelle.sms',
|
2015-02-10 13:06:55 +01:00
|
|
|
# connectors
|
2018-03-30 15:13:32 +02:00
|
|
|
'passerelle.apps.actesweb',
|
2017-11-23 12:11:55 +01:00
|
|
|
'passerelle.apps.airquality',
|
2019-03-29 16:35:13 +01:00
|
|
|
'passerelle.apps.api_entreprise',
|
2017-03-24 16:28:39 +01:00
|
|
|
'passerelle.apps.api_particulier',
|
2018-11-02 18:48:50 +01:00
|
|
|
'passerelle.apps.arcgis',
|
2019-03-29 16:35:13 +01:00
|
|
|
'passerelle.apps.arpege_ecp',
|
2019-06-11 17:30:31 +02:00
|
|
|
'passerelle.apps.astregs',
|
2019-05-27 19:00:44 +02:00
|
|
|
'passerelle.apps.atal',
|
2019-03-29 16:35:13 +01:00
|
|
|
'passerelle.apps.atos_genesys',
|
2017-11-23 12:11:55 +01:00
|
|
|
'passerelle.apps.base_adresse',
|
|
|
|
'passerelle.apps.bdp',
|
2018-10-09 19:10:36 +02:00
|
|
|
'passerelle.apps.cartads_cs',
|
2017-11-23 12:11:55 +01:00
|
|
|
'passerelle.apps.choosit',
|
|
|
|
'passerelle.apps.cityweb',
|
|
|
|
'passerelle.apps.clicrdv',
|
|
|
|
'passerelle.apps.cmis',
|
2020-02-20 17:19:34 +01:00
|
|
|
'passerelle.apps.cryptor',
|
2017-11-23 12:11:55 +01:00
|
|
|
'passerelle.apps.csvdatasource',
|
|
|
|
'passerelle.apps.family',
|
2017-06-29 21:09:04 +02:00
|
|
|
'passerelle.apps.feeds',
|
2017-11-23 12:11:55 +01:00
|
|
|
'passerelle.apps.gdc',
|
2019-09-06 14:02:28 +02:00
|
|
|
'passerelle.apps.gesbac',
|
2017-06-21 11:33:43 +02:00
|
|
|
'passerelle.apps.jsondatastore',
|
2019-04-07 00:17:54 +02:00
|
|
|
'passerelle.apps.sp_fr',
|
2020-09-24 15:18:59 +02:00
|
|
|
'passerelle.apps.maelis',
|
2019-09-20 21:56:44 +02:00
|
|
|
'passerelle.apps.mdel',
|
2019-10-18 10:54:20 +02:00
|
|
|
'passerelle.apps.mdel_ddpacs',
|
2017-11-23 12:11:55 +01:00
|
|
|
'passerelle.apps.mobyt',
|
2017-05-17 18:31:14 +02:00
|
|
|
'passerelle.apps.okina',
|
2020-03-30 18:38:04 +02:00
|
|
|
'passerelle.apps.opendatasoft',
|
2017-11-23 12:11:55 +01:00
|
|
|
'passerelle.apps.opengis',
|
|
|
|
'passerelle.apps.orange',
|
|
|
|
'passerelle.apps.ovh',
|
|
|
|
'passerelle.apps.oxyd',
|
2019-01-16 15:36:13 +01:00
|
|
|
'passerelle.apps.phonecalls',
|
2021-02-07 21:34:04 +01:00
|
|
|
'passerelle.apps.photon',
|
2017-10-11 09:15:38 +02:00
|
|
|
'passerelle.apps.solis',
|
2020-04-09 20:09:55 +02:00
|
|
|
'passerelle.apps.twilio',
|
2018-12-24 11:49:43 +01:00
|
|
|
'passerelle.apps.vivaticket',
|
2015-02-10 13:06:55 +01:00
|
|
|
# backoffice templates and static
|
|
|
|
'gadjo',
|
|
|
|
)
|
|
|
|
|
2017-05-13 21:15:46 +02:00
|
|
|
# disable some applications for now
|
2015-10-03 19:53:57 +02:00
|
|
|
PASSERELLE_APP_BDP_ENABLED = False
|
|
|
|
PASSERELLE_APP_GDC_ENABLED = False
|
2018-02-19 20:05:29 +01:00
|
|
|
PASSERELLE_APP_STRASBOURG_EU_ENABLED = False
|
2015-04-03 14:57:30 +02:00
|
|
|
|
2020-11-30 15:28:42 +01:00
|
|
|
# mark some apps as legacy
|
|
|
|
PASSERELLE_APP_CLICRDV_LEGACY = True
|
|
|
|
PASSERELLE_APP_SOLIS_APA_LEGACY = True
|
|
|
|
|
2015-02-11 21:15:55 +01:00
|
|
|
# Authentication settings
|
|
|
|
try:
|
|
|
|
import mellon
|
|
|
|
except ImportError:
|
|
|
|
mellon = None
|
|
|
|
|
|
|
|
if mellon is not None:
|
2018-04-24 14:00:26 +02:00
|
|
|
INSTALLED_APPS += ('mellon',)
|
2015-02-11 21:15:55 +01:00
|
|
|
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',
|
|
|
|
}
|
|
|
|
|
2015-04-30 01:03:19 +02:00
|
|
|
MELLON_USERNAME_TEMPLATE = '{attributes[name_id_content]}'
|
2015-02-10 13:06:55 +01:00
|
|
|
|
2015-02-11 21:15:55 +01:00
|
|
|
MELLON_IDENTITY_PROVIDERS = []
|
2015-02-10 13:06:55 +01:00
|
|
|
|
2021-01-14 15:00:15 +01:00
|
|
|
# management command, used to run afterjobs in uwsgi mode,
|
|
|
|
# usually /usr/bin/passerelle-manage.
|
|
|
|
PASSERELLE_MANAGE_COMMAND = None
|
|
|
|
|
2015-10-03 19:32:07 +02:00
|
|
|
# REQUESTS_PROXIES that can be used by requests methods
|
|
|
|
# see http://docs.python-requests.org/en/latest/user/advanced/#proxies
|
2017-11-30 17:19:59 +01:00
|
|
|
REQUESTS_PROXIES = None
|
2015-10-03 19:32:07 +02:00
|
|
|
|
2017-12-21 01:28:24 +01:00
|
|
|
# timeout used in python-requests call, in seconds
|
|
|
|
# we use 25s by default: timeout just before web server, which is usually 30s,
|
|
|
|
# and before clients, which usually use 28s (see w.c.s. or Combo)
|
|
|
|
REQUESTS_TIMEOUT = 25
|
|
|
|
|
2018-11-22 00:33:34 +01:00
|
|
|
# Passerelle can receive big requests (for example base64 encoded files)
|
|
|
|
DATA_UPLOAD_MAX_MEMORY_SIZE = 100*1024*1024
|
|
|
|
|
2020-10-07 11:31:03 +02:00
|
|
|
SITE_BASE_URL = 'http://localhost'
|
|
|
|
|
2017-12-18 23:53:35 +01:00
|
|
|
# List of passerelle.utils.Request response Content-Type to log
|
2017-03-20 17:04:33 +01:00
|
|
|
LOGGED_CONTENT_TYPES_MESSAGES = (
|
2017-03-20 17:57:11 +01:00
|
|
|
r'text/', r'application/(json|xml)'
|
2017-03-20 14:57:42 +01:00
|
|
|
)
|
|
|
|
|
2017-03-20 17:29:11 +01:00
|
|
|
# Max size of the response to log
|
2019-10-03 15:59:59 +02:00
|
|
|
LOGGED_RESPONSES_MAX_SIZE = 5000
|
2017-03-20 17:29:11 +01:00
|
|
|
|
2019-09-26 18:56:14 +02:00
|
|
|
# Max size of the request to log
|
2019-10-25 13:55:29 +02:00
|
|
|
LOGGED_REQUESTS_MAX_SIZE = 5000
|
2019-09-26 18:56:14 +02:00
|
|
|
|
2017-07-28 15:15:18 +02:00
|
|
|
# Number of days to keep logs
|
|
|
|
LOG_RETENTION_DAYS = 7
|
|
|
|
|
|
|
|
|
2016-04-06 18:39:39 +02:00
|
|
|
LOGGING = {
|
|
|
|
'version': 1,
|
|
|
|
'disable_existing_loggers': False,
|
|
|
|
'handlers': {
|
|
|
|
'console': {
|
|
|
|
'level': 'DEBUG',
|
|
|
|
'class': 'logging.StreamHandler',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'loggers': {
|
|
|
|
'django.request': {
|
|
|
|
'handlers': ['console'],
|
|
|
|
'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG'),
|
2017-06-13 14:33:03 +02:00
|
|
|
'propagate': True,
|
2016-04-06 18:39:39 +02:00
|
|
|
},
|
|
|
|
'passerelle.resource': {
|
|
|
|
'handlers': ['console'],
|
|
|
|
'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG'),
|
2017-06-13 14:33:03 +02:00
|
|
|
'propagate': True,
|
2016-04-06 18:39:39 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2015-02-10 13:06:55 +01:00
|
|
|
local_settings_file = os.environ.get('PASSERELLE_SETTINGS_FILE',
|
|
|
|
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
|
|
|
|
if os.path.exists(local_settings_file):
|
2020-01-08 11:35:39 +01:00
|
|
|
exec(open(local_settings_file).read())
|