81 lines
1.8 KiB
Python
81 lines
1.8 KiB
Python
"""
|
|
Settings pour la mise en production de l'annuaire.
|
|
"""
|
|
|
|
import os
|
|
|
|
from .common import * # NOQA
|
|
from .common import (
|
|
BASE_DIR,
|
|
import_secret,
|
|
)
|
|
|
|
# ---
|
|
# Prod-specific secrets
|
|
# ---
|
|
|
|
REDIS_PASSWD = import_secret("REDIS_PASSWD")
|
|
REDIS_DB = import_secret("REDIS_DB")
|
|
REDIS_HOST = import_secret("REDIS_HOST")
|
|
REDIS_PORT = import_secret("REDIS_PORT")
|
|
|
|
DBNAME = import_secret("DBNAME")
|
|
DBUSER = import_secret("DBUSER")
|
|
DBPASSWD = import_secret("DBPASSWD")
|
|
|
|
# ---
|
|
# À modifier possiblement lors de la mise en production
|
|
# ---
|
|
|
|
ALLOWED_HOSTS = ["annuaire.eleves.ens.fr", "www.annuaire.eleves.ens.fr"]
|
|
|
|
STATIC_ROOT = os.path.join(
|
|
os.path.dirname(os.path.dirname(BASE_DIR)), "public", "annuaire", "static"
|
|
)
|
|
|
|
STATIC_URL = "/static/"
|
|
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "media")
|
|
MEDIA_URL = "/media/"
|
|
|
|
# ---
|
|
# 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
|
|
),
|
|
}
|
|
}
|
|
|
|
# ---
|
|
# Prod database settings
|
|
# ---
|
|
|
|
DATABASES = {
|
|
"default": {
|
|
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
|
"NAME": DBNAME,
|
|
"USER": DBUSER,
|
|
"PASSWORD": DBPASSWD,
|
|
"HOST": os.environ.get("DBHOST", "localhost"),
|
|
}
|
|
}
|
|
|
|
|
|
AUTH_PASSWORD_VALIDATORS = [
|
|
{
|
|
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", # noqa
|
|
},
|
|
{
|
|
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
|
},
|
|
{
|
|
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
|
},
|
|
{
|
|
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
|
},
|
|
]
|