2016-07-15 00:02:56 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2016-05-26 04:06:17 +02:00
|
|
|
"""
|
|
|
|
Django settings for cof project.
|
|
|
|
|
|
|
|
For more information on this file, see
|
|
|
|
https://docs.djangoproject.com/en/1.8/topics/settings/
|
|
|
|
|
|
|
|
For the full list of settings and their values, see
|
|
|
|
https://docs.djangoproject.com/en/1.8/ref/settings/
|
|
|
|
"""
|
|
|
|
|
2016-07-15 00:02:56 +02:00
|
|
|
from __future__ import division
|
|
|
|
from __future__ import print_function
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2016-05-26 04:06:17 +02:00
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
|
|
import os
|
|
|
|
|
|
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
|
2016-06-10 00:49:04 +02:00
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
2016-05-26 04:06:17 +02:00
|
|
|
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
|
|
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
|
|
|
|
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
|
|
SECRET_KEY = 'q()(zn4m63i%5cp4)f+ww4-28_w+ly3q9=6imw2ciu&_(5_4ah'
|
|
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
|
|
DEBUG = True
|
|
|
|
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = (
|
|
|
|
'gestioncof',
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.sites',
|
|
|
|
'django.contrib.messages',
|
|
|
|
'django.contrib.staticfiles',
|
|
|
|
'grappelli',
|
|
|
|
'django.contrib.admin',
|
|
|
|
'django.contrib.admindocs',
|
|
|
|
'bda',
|
|
|
|
'autocomplete_light',
|
|
|
|
'captcha',
|
2016-05-26 22:20:04 +02:00
|
|
|
'django_cas_ng',
|
2016-05-26 04:06:17 +02:00
|
|
|
'debug_toolbar',
|
2016-07-11 21:48:11 +02:00
|
|
|
'bootstrapform',
|
2016-08-02 10:40:46 +02:00
|
|
|
'kfet',
|
2016-08-14 20:31:22 +02:00
|
|
|
'channels',
|
2016-09-03 16:29:32 +02:00
|
|
|
'widget_tweaks',
|
2016-05-26 04:06:17 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
MIDDLEWARE_CLASSES = (
|
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
2016-08-19 06:20:37 +02:00
|
|
|
'kfet.middleware.KFetAuthenticationMiddleware',
|
2016-05-26 04:06:17 +02:00
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
|
|
'django.middleware.security.SecurityMiddleware',
|
|
|
|
)
|
|
|
|
|
|
|
|
ROOT_URLCONF = 'cof.urls'
|
|
|
|
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
'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',
|
|
|
|
'django.core.context_processors.i18n',
|
|
|
|
'django.core.context_processors.media',
|
|
|
|
'django.core.context_processors.static',
|
|
|
|
'gestioncof.shared.context_processor',
|
2016-08-20 23:31:30 +02:00
|
|
|
'kfet.context_processors.auth',
|
2016-05-26 04:06:17 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
# WSGI_APPLICATION = 'cof.wsgi.application'
|
|
|
|
|
|
|
|
# Database
|
|
|
|
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
|
|
|
|
|
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.db.backends.mysql',
|
|
|
|
'NAME': os.environ['DBNAME'],
|
|
|
|
'USER': os.environ['DBUSER'],
|
|
|
|
'PASSWORD': os.environ['DBPASSWD'],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Internationalization
|
|
|
|
# https://docs.djangoproject.com/en/1.8/topics/i18n/
|
|
|
|
|
|
|
|
LANGUAGE_CODE = 'fr-fr'
|
|
|
|
|
|
|
|
TIME_ZONE = 'Europe/Paris'
|
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
|
|
# https://docs.djangoproject.com/en/1.8/howto/static-files/
|
|
|
|
|
|
|
|
STATIC_URL = '/static/'
|
2016-09-12 16:49:37 +02:00
|
|
|
STATIC_ROOT = '/var/www/static/'
|
2016-05-26 04:06:17 +02:00
|
|
|
|
2016-08-21 16:30:22 +02:00
|
|
|
STATICFILES_DIRS = (
|
2016-11-05 21:59:49 +01:00
|
|
|
os.path.join(BASE_DIR, 'static/'),
|
2016-08-21 16:30:22 +02:00
|
|
|
)
|
|
|
|
|
2016-07-09 19:49:38 +02:00
|
|
|
# Media upload (through ImageField, SiteField)
|
|
|
|
# https://docs.djangoproject.com/en/1.9/ref/models/fields/
|
|
|
|
|
2016-07-10 00:06:59 +02:00
|
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
|
2016-07-09 19:49:38 +02:00
|
|
|
MEDIA_URL = '/media/'
|
|
|
|
|
2016-05-26 04:06:17 +02:00
|
|
|
# Various additional settings
|
|
|
|
SITE_ID = 1
|
|
|
|
|
|
|
|
# URL prefix for admin static files -- CSS, JavaScript and images.
|
|
|
|
# Make sure to use a trailing slash.
|
|
|
|
# Examples: "http://foo.com/static/admin/", "/static/admin/".
|
|
|
|
ADMIN_MEDIA_PREFIX = '/static/grappelli/'
|
|
|
|
GRAPPELLI_ADMIN_HEADLINE = "GestioCOF"
|
|
|
|
GRAPPELLI_ADMIN_TITLE = "<a href=\"/\">GestioCOF</a>"
|
|
|
|
|
2016-09-27 17:57:53 +02:00
|
|
|
MAIL_DATA = {
|
|
|
|
'petits_cours': {
|
|
|
|
'FROM': "Le COF <cof@ens.fr>",
|
|
|
|
'BCC': "archivescof@gmail.com",
|
|
|
|
'REPLYTO': "cof@ens.fr"},
|
|
|
|
'rappels': {
|
|
|
|
'FROM': 'Le BdA <bda@ens.fr>',
|
|
|
|
'REPLYTO': 'Le BdA <bda@ens.fr>'},
|
|
|
|
'revente': {
|
2016-10-03 01:58:55 +02:00
|
|
|
'FROM': 'BdA-Revente <bda-revente@ens.fr>',
|
|
|
|
'REPLYTO': 'BdA-Revente <bda-revente@ens.fr>'},
|
2016-09-27 17:57:53 +02:00
|
|
|
}
|
2016-07-29 01:50:08 +02:00
|
|
|
|
2016-09-24 19:34:36 +02:00
|
|
|
LOGIN_URL = "/gestion/login"
|
|
|
|
LOGIN_REDIRECT_URL = "/gestion/"
|
2016-05-26 04:06:17 +02:00
|
|
|
|
|
|
|
CAS_SERVER_URL = 'https://cas.eleves.ens.fr/'
|
|
|
|
CAS_IGNORE_REFERER = True
|
2016-09-24 19:34:36 +02:00
|
|
|
CAS_REDIRECT_URL = '/gestion/'
|
2016-05-26 04:06:17 +02:00
|
|
|
CAS_EMAIL_FORMAT = "%s@clipper.ens.fr"
|
|
|
|
AUTHENTICATION_BACKENDS = (
|
|
|
|
'django.contrib.auth.backends.ModelBackend',
|
|
|
|
'gestioncof.shared.COFCASBackend',
|
|
|
|
)
|
|
|
|
|
|
|
|
# EMAIL_HOST="nef.ens.fr"
|
|
|
|
|
|
|
|
RECAPTCHA_PUBLIC_KEY = "DUMMY"
|
|
|
|
RECAPTCHA_PRIVATE_KEY = "DUMMY"
|
|
|
|
RECAPTCHA_USE_SSL = True
|
2016-05-27 01:04:35 +02:00
|
|
|
|
2016-08-14 20:31:22 +02:00
|
|
|
# Channels settings
|
|
|
|
|
|
|
|
CHANNEL_LAYERS = {
|
|
|
|
"default": {
|
|
|
|
"BACKEND": "asgi_redis.RedisChannelLayer",
|
|
|
|
"CONFIG": {
|
2016-09-12 16:49:37 +02:00
|
|
|
"hosts": [("localhost", 6379)],
|
2016-08-14 20:31:22 +02:00
|
|
|
},
|
|
|
|
"ROUTING": "cof.routing.channel_routing",
|
|
|
|
}
|
|
|
|
}
|
2016-07-09 22:31:56 +02:00
|
|
|
|
2016-09-11 13:49:10 +02:00
|
|
|
|
2016-05-27 01:04:35 +02:00
|
|
|
def show_toolbar(request):
|
2016-07-09 22:31:56 +02:00
|
|
|
"""
|
|
|
|
On ne veut pas la vérification de INTERNAL_IPS faite par la debug-toolbar
|
|
|
|
car cela interfère avec l'utilisation de Vagrant. En effet, l'adresse de la
|
|
|
|
machine physique n'est pas forcément connue, et peut difficilement être
|
|
|
|
mise dans les INTERNAL_IPS.
|
|
|
|
"""
|
2016-05-27 01:04:35 +02:00
|
|
|
if not DEBUG:
|
|
|
|
return False
|
|
|
|
if request.is_ajax():
|
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
|
|
|
DEBUG_TOOLBAR_CONFIG = {
|
|
|
|
'SHOW_TOOLBAR_CALLBACK': show_toolbar,
|
|
|
|
}
|
2016-11-08 10:24:17 +01:00
|
|
|
|
|
|
|
FORMAT_MODULE_PATH = 'cof.locale'
|