67 lines
1.9 KiB
Python
67 lines
1.9 KiB
Python
"""
|
|
Paramètres de production pour l'annuaire.
|
|
"""
|
|
|
|
import os
|
|
|
|
from .common import * # noqa
|
|
from .common import BASE_DIR, get_secret
|
|
|
|
# #############################################################################
|
|
# Prod-specific secrets
|
|
# #############################################################################
|
|
|
|
REDIS_PASSWD = get_secret("REDIS_PASSWD")
|
|
REDIS_DB = get_secret("REDIS_DB")
|
|
REDIS_HOST = get_secret("REDIS_HOST")
|
|
REDIS_PORT = get_secret("REDIS_PORT")
|
|
|
|
DBNAME = get_secret("DBNAME")
|
|
DBUSER = get_secret("DBUSER")
|
|
DBPASSWD = get_secret("DBPASSWD")
|
|
|
|
ALLOWED_HOSTS = ["annuaire.eleves.ens.fr", "www.annuaire.eleves.ens.fr"]
|
|
|
|
STATIC_ROOT = BASE_DIR.parent / "public" / "annuaire" / "static"
|
|
|
|
STATIC_URL = "/static/"
|
|
MEDIA_ROOT = BASE_DIR / "media"
|
|
MEDIA_URL = "/media/"
|
|
|
|
# #############################################################################
|
|
# Cache settings
|
|
# #############################################################################
|
|
|
|
CACHES = {
|
|
"default": {
|
|
"BACKEND": "django_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 = map(
|
|
lambda v: {"NAME": f"django.contrib.auth.password_validation.{v}"},
|
|
[
|
|
"UserAttributeSimilarityValidator",
|
|
"MinimumLengthValidator",
|
|
"CommonPasswordValidator",
|
|
"NumericPasswordValidator",
|
|
],
|
|
)
|