""" Configuration pour l'environnement de production. """ from .base import * # noqa: F401, F403 from decouple import config, Csv DEBUG = False ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv(), default='localhost') # Sécurité HTTPS SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') SECURE_SSL_REDIRECT = True SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True SECURE_HSTS_SECONDS = 31536000 SECURE_HSTS_INCLUDE_SUBDOMAINS = True SECURE_HSTS_PRELOAD = True SECURE_CONTENT_TYPE_NOSNIFF = True X_FRAME_OPTIONS = 'DENY' # Cache des sessions SESSION_ENGINE = 'django.contrib.sessions.backends.db' # Logging en production vers fichier LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format': '{levelname} {asctime} {module} {message}', 'style': '{', }, }, 'handlers': { 'file': { 'class': 'logging.FileHandler', 'filename': '/var/log/logis/django.log', 'formatter': 'verbose', }, }, 'root': { 'handlers': ['file'], 'level': 'WARNING', }, 'loggers': { 'django.request': { 'handlers': ['file'], 'level': 'ERROR', # 404 → silencieux, seuls les 500 sont loggués 'propagate': False, }, 'django.security': { 'handlers': ['file'], 'level': 'ERROR', 'propagate': False, }, 'properties': { 'handlers': ['file'], 'level': 'INFO', 'propagate': False, }, }, }