2020-05-09 15:48:51 +02:00
|
|
|
"""
|
|
|
|
Django development settings for the cof project.
|
|
|
|
The settings that are not listed here are imported from .common
|
|
|
|
"""
|
|
|
|
import os
|
|
|
|
|
2020-07-10 22:53:44 +02:00
|
|
|
from .common import * # NOQA
|
2020-05-09 15:48:51 +02:00
|
|
|
from .common import (
|
|
|
|
AUTHENTICATION_BACKENDS,
|
|
|
|
BASE_DIR,
|
|
|
|
INSTALLED_APPS,
|
|
|
|
MIDDLEWARE,
|
|
|
|
TEMPLATES,
|
|
|
|
import_secret,
|
|
|
|
)
|
|
|
|
|
|
|
|
# ---
|
|
|
|
# COF-specific secrets
|
|
|
|
# ---
|
|
|
|
|
2020-08-24 14:55:27 +02:00
|
|
|
REDIS_PASSWD = import_secret("REDIS_PASSWD")
|
|
|
|
REDIS_DB = import_secret("REDIS_DB")
|
|
|
|
REDIS_HOST = import_secret("REDIS_HOST")
|
|
|
|
REDIS_PORT = import_secret("REDIS_PORT")
|
|
|
|
|
2020-05-09 15:48:51 +02:00
|
|
|
RECAPTCHA_PUBLIC_KEY = import_secret("RECAPTCHA_PUBLIC_KEY")
|
|
|
|
RECAPTCHA_PRIVATE_KEY = import_secret("RECAPTCHA_PRIVATE_KEY")
|
|
|
|
KFETOPEN_TOKEN = import_secret("KFETOPEN_TOKEN")
|
|
|
|
|
|
|
|
# ---
|
|
|
|
# COF-only Django settings
|
|
|
|
# ---
|
|
|
|
|
|
|
|
ALLOWED_HOSTS = ["cof.ens.fr", "www.cof.ens.fr", "dev.cof.ens.fr"]
|
|
|
|
|
|
|
|
INSTALLED_APPS = (
|
|
|
|
[
|
|
|
|
"gestioncof",
|
|
|
|
# Must be before django admin
|
|
|
|
# https://github.com/infoportugal/wagtail-modeltranslation/issues/193
|
|
|
|
"wagtail_modeltranslation",
|
|
|
|
"wagtail_modeltranslation.makemigrations",
|
|
|
|
"wagtail_modeltranslation.migrate",
|
|
|
|
"modeltranslation",
|
|
|
|
]
|
|
|
|
+ INSTALLED_APPS
|
|
|
|
+ [
|
|
|
|
"bda",
|
|
|
|
"petitscours",
|
|
|
|
"captcha",
|
|
|
|
"kfet",
|
|
|
|
"kfet.open",
|
|
|
|
"channels",
|
|
|
|
"custommail",
|
|
|
|
"djconfig",
|
|
|
|
"wagtail.contrib.forms",
|
|
|
|
"wagtail.contrib.redirects",
|
|
|
|
"wagtail.embeds",
|
|
|
|
"wagtail.sites",
|
|
|
|
"wagtail.users",
|
|
|
|
"wagtail.snippets",
|
|
|
|
"wagtail.documents",
|
|
|
|
"wagtail.images",
|
|
|
|
"wagtail.search",
|
|
|
|
"wagtail.admin",
|
|
|
|
"wagtail.core",
|
|
|
|
"wagtail.contrib.modeladmin",
|
|
|
|
"wagtail.contrib.routable_page",
|
|
|
|
"wagtailmenus",
|
|
|
|
"modelcluster",
|
|
|
|
"taggit",
|
|
|
|
"kfet.auth",
|
|
|
|
"kfet.cms",
|
|
|
|
"gestioncof.cms",
|
|
|
|
"django_js_reverse",
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|
|
|
|
MIDDLEWARE = (
|
|
|
|
["corsheaders.middleware.CorsMiddleware"]
|
|
|
|
+ MIDDLEWARE
|
|
|
|
+ [
|
|
|
|
"djconfig.middleware.DjConfigMiddleware",
|
|
|
|
"wagtail.core.middleware.SiteMiddleware",
|
|
|
|
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|
|
|
|
TEMPLATES[0]["OPTIONS"]["context_processors"] += [
|
|
|
|
"wagtailmenus.context_processors.wagtailmenus",
|
|
|
|
"djconfig.context_processors.config",
|
|
|
|
"gestioncof.shared.context_processor",
|
|
|
|
"kfet.auth.context_processors.temporary_auth",
|
|
|
|
"kfet.context_processors.config",
|
|
|
|
]
|
|
|
|
|
|
|
|
STATIC_ROOT = os.path.join(
|
|
|
|
os.path.dirname(os.path.dirname(BASE_DIR)), "public", "gestion", "static"
|
|
|
|
)
|
|
|
|
|
|
|
|
STATIC_URL = "/gestion/static/"
|
|
|
|
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "media")
|
|
|
|
MEDIA_URL = "/gestion/media/"
|
|
|
|
|
|
|
|
CORS_ORIGIN_WHITELIST = ("bda.ens.fr", "www.bda.ens.fr" "cof.ens.fr", "www.cof.ens.fr")
|
|
|
|
|
|
|
|
|
|
|
|
# ---
|
|
|
|
# Auth-related stuff
|
|
|
|
# ---
|
|
|
|
|
|
|
|
AUTHENTICATION_BACKENDS += [
|
|
|
|
"gestioncof.shared.COFCASBackend",
|
|
|
|
"kfet.auth.backends.GenericBackend",
|
|
|
|
]
|
|
|
|
|
|
|
|
LOGIN_URL = "cof-login"
|
|
|
|
LOGIN_REDIRECT_URL = "home"
|
|
|
|
|
2020-08-24 14:55:27 +02:00
|
|
|
# ---
|
|
|
|
# Cache settings
|
|
|
|
# ---
|
|
|
|
|
|
|
|
CACHES = {
|
|
|
|
"default": {
|
|
|
|
"BACKEND": "redis_cache.RedisCache",
|
|
|
|
"LOCATION": "redis://:{passwd}@{host}:{port}/{db}".format(
|
|
|
|
passwd=REDIS_PASSWD, host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB
|
|
|
|
),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# ---
|
|
|
|
# Channels settings
|
|
|
|
# ---
|
|
|
|
|
|
|
|
CHANNEL_LAYERS = {
|
|
|
|
"default": {
|
|
|
|
"BACKEND": "asgi_redis.RedisChannelLayer",
|
|
|
|
"CONFIG": {
|
|
|
|
"hosts": [
|
|
|
|
(
|
|
|
|
"redis://:{passwd}@{host}:{port}/{db}".format(
|
|
|
|
passwd=REDIS_PASSWD,
|
|
|
|
host=REDIS_HOST,
|
|
|
|
port=REDIS_PORT,
|
|
|
|
db=REDIS_DB,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"ROUTING": "cof.routing.routing",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-09 15:48:51 +02:00
|
|
|
|
|
|
|
# ---
|
|
|
|
# reCAPTCHA settings
|
|
|
|
# https://github.com/praekelt/django-recaptcha
|
|
|
|
#
|
|
|
|
# Default settings authorize reCAPTCHA usage for local developement.
|
|
|
|
# Public and private keys are appended in the 'prod' module settings.
|
|
|
|
# ---
|
|
|
|
|
|
|
|
NOCAPTCHA = True
|
|
|
|
RECAPTCHA_USE_SSL = True
|
|
|
|
|
|
|
|
|
|
|
|
# ---
|
|
|
|
# Wagtail settings
|
|
|
|
# ---
|
|
|
|
|
|
|
|
WAGTAIL_SITE_NAME = "GestioCOF"
|
|
|
|
WAGTAIL_ENABLE_UPDATE_CHECK = False
|
|
|
|
TAGGIT_CASE_INSENSITIVE = True
|
|
|
|
|
|
|
|
|
|
|
|
# ---
|
|
|
|
# Django-js-reverse settings
|
|
|
|
# ---
|
|
|
|
|
|
|
|
JS_REVERSE_JS_VAR_NAME = "django_urls"
|
|
|
|
# Quand on aura namespace les urls...
|
|
|
|
# JS_REVERSE_INCLUDE_ONLY_NAMESPACES = ['k-fet']
|
|
|
|
|
|
|
|
|
|
|
|
# ---
|
|
|
|
# Mail config
|
|
|
|
# ---
|
|
|
|
|
|
|
|
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": {
|
|
|
|
"FROM": "BdA-Revente <bda-revente@ens.fr>",
|
|
|
|
"REPLYTO": "BdA-Revente <bda-revente@ens.fr>",
|
|
|
|
},
|
|
|
|
}
|
2020-08-30 11:31:44 +02:00
|
|
|
|
|
|
|
# ---
|
|
|
|
# SiteCOF URL rewrite rules
|
|
|
|
# ---
|
|
|
|
|
|
|
|
SITECOF_INTERNAL_URL = r"/gestion/(en/|fr/|)sitecof/"
|
|
|
|
SITECOF_PUBLIC_URL = r"/\\1news/"
|