annuaire-eleves/annuaire/settings.py

166 lines
4 KiB
Python
Raw Normal View History

2019-02-11 22:52:48 +01:00
"""
Django settings for annuaire project.
Generated by 'django-admin startproject' using Django 2.2b1.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
import os
2021-02-05 22:02:23 +01:00
from django.urls import reverse_lazy
2019-02-11 22:52:48 +01:00
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# 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!
2020-11-13 11:43:34 +01:00
SECRET_KEY = "84=n(@@wl(04oc$(-+3surgrlf&uq3=m)=(hpg$immi1h69s)p"
2019-02-11 22:52:48 +01:00
2020-11-13 11:44:53 +01:00
# À bouger dans un ficher secret quand il sera créé ?
LDAP = {
"SPI": {
"PROTOCOL": "ldaps",
"URL": "ldap.spi.ens.fr",
"PORT": 636,
},
"CRI": {
"PROTOCOL": "ldap",
"URL": "annuaire.ens.fr",
"PORT": 389,
},
}
ANNUAIRE = {
"PROTOCOL": "http",
"URL": "annuaireweb.ens.fr",
"PORT": 80,
}
2019-02-11 22:52:48 +01:00
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
2020-11-13 11:43:34 +01:00
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
2021-02-05 22:02:23 +01:00
"authens",
2020-11-13 11:43:34 +01:00
"fiches",
2019-02-11 22:52:48 +01:00
]
MIDDLEWARE = [
2020-11-13 11:43:34 +01:00
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
2021-01-28 00:29:20 +01:00
"django.middleware.locale.LocaleMiddleware",
2020-11-13 11:43:34 +01:00
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
2019-02-11 22:52:48 +01:00
]
2020-11-13 11:43:34 +01:00
ROOT_URLCONF = "annuaire.urls"
2019-02-11 22:52:48 +01:00
TEMPLATES = [
{
2020-11-13 11:43:34 +01:00
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
2019-02-11 22:52:48 +01:00
],
},
},
]
2020-02-12 23:21:24 +01:00
AUTHENTICATION_BACKENDS = (
2020-11-13 11:43:34 +01:00
"django.contrib.auth.backends.ModelBackend",
2021-02-05 22:02:23 +01:00
"fiches.backends.BackendFiches",
2020-02-12 23:21:24 +01:00
)
2020-11-13 11:43:34 +01:00
WSGI_APPLICATION = "annuaire.wsgi.application"
2019-02-11 22:52:48 +01:00
# Database
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = {
2020-11-13 11:43:34 +01:00
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
2019-02-11 22:52:48 +01:00
}
}
# Password validation
# https://docs.djangoproject.com/en/dev/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
2020-11-13 11:43:34 +01:00
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
2019-02-11 22:52:48 +01:00
},
{
2020-11-13 11:43:34 +01:00
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
2019-02-11 22:52:48 +01:00
},
{
2020-11-13 11:43:34 +01:00
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
2019-02-11 22:52:48 +01:00
},
{
2020-11-13 11:43:34 +01:00
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
2019-02-11 22:52:48 +01:00
},
]
# Internationalization
# https://docs.djangoproject.com/en/dev/topics/i18n/
2020-11-13 11:43:34 +01:00
LANGUAGE_CODE = "fr-fr"
2019-02-11 22:52:48 +01:00
2021-01-28 00:54:08 +01:00
LANGUAGES = [
("fr", "Français"),
("en", "English"),
]
LOCALE_PATHS = [os.path.join(BASE_DIR, "locale")]
2020-11-13 11:43:34 +01:00
TIME_ZONE = "UTC"
2019-02-11 22:52:48 +01:00
USE_I18N = True
USE_L10N = False
2019-02-11 22:52:48 +01:00
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/dev/howto/static-files/
2020-11-13 11:43:34 +01:00
STATIC_URL = "/static/"
2019-04-08 21:47:50 +02:00
2020-11-13 11:43:34 +01:00
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
2019-04-08 21:47:50 +02:00
2020-11-13 11:43:34 +01:00
MEDIA_URL = "/media/"
2020-02-12 23:21:24 +01:00
2021-02-05 22:02:23 +01:00
LOGIN_URL = reverse_lazy("authens:login")
LOGOUT_REDIRECT_URL = reverse_lazy("home")
AUTHENS_USE_OLDCAS = False
2020-02-12 23:21:24 +01:00
2020-11-13 11:43:34 +01:00
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"