experiENS/app/settings_base.py

144 lines
3.7 KiB
Python
Raw Normal View History

2017-04-04 00:31:50 +02:00
"""
Django settings for experiENS project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
2021-06-29 00:11:18 +02:00
2021-02-07 18:23:24 +01:00
from django.urls import reverse_lazy
2017-04-07 03:01:27 +02:00
2021-06-29 00:11:18 +02:00
from .secrets import GOOGLE_API_KEY, MAPBOX_API_KEY, SECRET_KEY # noqa
2019-02-25 17:17:58 +01:00
2017-04-04 00:31:50 +02:00
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
2021-02-07 23:15:47 +01:00
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.gis",
"django.contrib.sites",
"django_elasticsearch_dsl",
2021-06-29 00:11:18 +02:00
# 'allauth', # Uncomment that part when you
# 'allauth.account', # apply migration
# 'allauth.socialaccount', # Allauth -> AuthENS
2021-02-07 23:15:47 +01:00
"simple_email_confirmation",
"authens",
"tastypie",
"braces",
"tinymce",
"taggit",
"taggit_autosuggest",
"avisstage",
]
2017-04-04 00:31:50 +02:00
2021-02-07 18:23:24 +01:00
MIDDLEWARE = (
2021-02-07 23:15:47 +01:00
"django.middleware.security.SecurityMiddleware",
"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",
2017-04-04 00:31:50 +02:00
)
2017-04-05 00:23:35 +02:00
TEMPLATES = [
{
2021-02-07 23:15:47 +01:00
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
2017-04-05 00:23:35 +02:00
# insert your TEMPLATE_DIRS here
],
2021-02-07 23:15:47 +01:00
"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.template.context_processors.request",
"django.contrib.messages.context_processors.messages",
2017-04-05 00:23:35 +02:00
],
},
},
]
2021-02-07 23:15:47 +01:00
ROOT_URLCONF = "experiENS.urls"
2017-04-04 00:31:50 +02:00
2021-02-07 23:15:47 +01:00
WSGI_APPLICATION = "experiENS.wsgi.application"
2017-04-04 00:31:50 +02:00
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
2021-02-07 23:15:47 +01:00
LANGUAGE_CODE = "fr"
2017-04-04 00:31:50 +02:00
2021-02-07 23:15:47 +01:00
TIME_ZONE = "Europe/Paris"
2017-04-04 00:31:50 +02:00
USE_I18N = True
USE_L10N = True
USE_TZ = True
2018-12-27 21:05:59 +01:00
SITE_ID = 1
2017-04-04 00:31:50 +02:00
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
2021-02-07 23:15:47 +01:00
STATIC_URL = "/static/"
2017-04-04 00:28:25 +02:00
2017-04-05 00:23:35 +02:00
AUTHENTICATION_BACKENDS = (
2021-02-07 23:15:47 +01:00
"django.contrib.auth.backends.ModelBackend",
"experiENS.auth.ENSCASBackend",
2017-04-05 00:23:35 +02:00
)
2021-02-07 23:15:47 +01:00
CAS_SERVER_URL = "https://cas.eleves.ens.fr/" # SPI CAS
2021-02-07 18:23:24 +01:00
AUTHENS_USE_OLDCAS = False
2021-02-07 23:15:47 +01:00
LOGIN_URL = reverse_lazy("authens:login")
LOGOUT_URL = reverse_lazy("authens:logout")
LOGIN_REDIRECT_URL = reverse_lazy("avisstage:perso")
LOGOUT_REDIRECT_URL = reverse_lazy("avisstage:index")
2018-12-26 20:23:20 +01:00
LOGGING = {
2021-02-07 23:15:47 +01:00
"version": 1,
"disable_existing_loggers": False,
"handlers": {
"file": {
"level": "INFO",
"class": "logging.FileHandler",
"filename": os.path.join(BASE_DIR, "recherche.log"),
2018-12-26 20:23:20 +01:00
},
},
2021-02-07 23:15:47 +01:00
"loggers": {
"recherche": {
"handlers": ["file"],
"level": "INFO",
"propagate": True,
2018-12-26 20:23:20 +01:00
},
},
}