2017-05-16 20:52:59 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2016-09-28 20:36:48 +02:00
|
|
|
"""
|
2017-05-16 20:52:59 +02:00
|
|
|
Django common settings for GestionÉvénementiel
|
2016-09-28 20:36:48 +02:00
|
|
|
|
2017-05-16 20:52:59 +02:00
|
|
|
Everything which is supposed to be identical between the production server and
|
|
|
|
the local development server should be here.
|
2016-09-28 20:36:48 +02:00
|
|
|
|
2017-05-16 20:52:59 +02:00
|
|
|
We also load the secrets in this file.
|
2016-09-28 20:36:48 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
2017-05-16 20:52:59 +02:00
|
|
|
from . import secret
|
|
|
|
|
2016-09-28 20:36:48 +02:00
|
|
|
|
2017-05-16 20:52:59 +02:00
|
|
|
def import_secret(name):
|
|
|
|
"""
|
|
|
|
Shorthand for importing a value from the secret module and raising an
|
|
|
|
informative exception if a secret is missing.
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
return getattr(secret, name)
|
|
|
|
except AttributeError:
|
|
|
|
raise RuntimeError("Secret missing: {}".format(name))
|
2016-09-28 20:36:48 +02:00
|
|
|
|
|
|
|
|
2017-05-16 20:52:59 +02:00
|
|
|
SECRET_KEY = import_secret("SECRET_KEY")
|
|
|
|
ADMINS = import_secret("ADMINS")
|
2016-09-28 20:36:48 +02:00
|
|
|
|
2017-05-16 20:52:59 +02:00
|
|
|
DBNAME = import_secret("DBNAME")
|
|
|
|
DBUSER = import_secret("DBUSER")
|
|
|
|
DBPASSWD = import_secret("DBPASSWD")
|
2016-09-28 20:36:48 +02:00
|
|
|
|
2017-05-16 20:52:59 +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")
|
2016-09-28 20:36:48 +02:00
|
|
|
|
2017-05-17 17:18:13 +02:00
|
|
|
CREATE_USER_KEY = import_secret("CREATE_USER_KEY")
|
|
|
|
|
2016-09-28 20:36:48 +02:00
|
|
|
|
2017-05-16 20:52:59 +02:00
|
|
|
BASE_DIR = os.path.dirname(
|
|
|
|
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
)
|
2016-09-28 20:36:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
INSTALLED_APPS = [
|
2016-10-14 13:00:51 +02:00
|
|
|
'equipment.apps.EquipmentConfig',
|
2016-09-30 20:10:35 +02:00
|
|
|
'event.apps.EventConfig',
|
2017-05-17 11:33:05 +02:00
|
|
|
'users.apps.UsersConfig',
|
2017-02-21 11:07:36 +01:00
|
|
|
'shared.apps.SharedConfig',
|
2016-09-28 20:36:48 +02:00
|
|
|
'django.contrib.admin',
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.messages',
|
|
|
|
'django.contrib.staticfiles',
|
2017-05-16 17:13:31 +02:00
|
|
|
'channels',
|
2016-09-29 00:51:36 +02:00
|
|
|
'bootstrapform',
|
2017-02-21 11:07:36 +01:00
|
|
|
'widget_tweaks',
|
2016-09-28 20:36:48 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
MIDDLEWARE_CLASSES = [
|
|
|
|
'django.middleware.security.SecurityMiddleware',
|
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
|
|
]
|
|
|
|
|
|
|
|
ROOT_URLCONF = 'evenementiel.urls'
|
|
|
|
|
2017-05-16 20:52:59 +02:00
|
|
|
STATIC_URL = "/static/"
|
|
|
|
MEDIA_URL = "/media/"
|
|
|
|
|
|
|
|
LOGIN_REDIRECT_URL = 'shared:home'
|
|
|
|
LOGOUT_REDIRECT_URL = 'shared:home'
|
2017-02-21 16:02:23 +01:00
|
|
|
|
2016-09-28 20:36:48 +02:00
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
2017-02-21 11:07:36 +01:00
|
|
|
'DIRS': [],
|
2016-09-28 20:36:48 +02:00
|
|
|
'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',
|
2017-02-21 11:07:36 +01:00
|
|
|
'shared.shared.context_processor',
|
2016-09-28 20:36:48 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
2017-05-16 12:42:53 +02:00
|
|
|
'ENGINE': 'django.db.backends.postgresql',
|
2017-05-16 22:43:30 +02:00
|
|
|
'NAME': DBNAME,
|
|
|
|
'USER': DBUSER,
|
|
|
|
'PASSWORD': DBPASSWD,
|
2016-09-28 20:36:48 +02:00
|
|
|
'PORT': 5432,
|
2016-09-29 00:13:16 +02:00
|
|
|
'HOST': 'localhost',
|
2016-09-28 20:36:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-16 20:52:59 +02:00
|
|
|
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": "evenementiel.routing.channel_routing",
|
|
|
|
}
|
|
|
|
}
|
2016-09-28 20:36:48 +02:00
|
|
|
|
|
|
|
# Password validation
|
|
|
|
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
|
|
|
|
AUTH_PASSWORD_VALIDATORS = [
|
2016-09-29 00:51:36 +02:00
|
|
|
{'NAME': 'django.contrib.auth.password_validation'
|
|
|
|
'.UserAttributeSimilarityValidator'},
|
|
|
|
{'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'},
|
|
|
|
{'NAME': 'django.contrib.auth.password_validation'
|
|
|
|
'.CommonPasswordValidator'},
|
|
|
|
{'NAME': 'django.contrib.auth.password_validation'
|
|
|
|
'.NumericPasswordValidator'},
|
2016-09-28 20:36:48 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
# Internationalization
|
2017-05-16 20:52:59 +02:00
|
|
|
# https://docs.djangoproject.com/en/1.8/topics/i18n/
|
2016-09-28 20:36:48 +02:00
|
|
|
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
USE_TZ = True
|