Add Django author accounts for level editor access (login, nginx auth_request, brute-force lockout), MariaDB production settings

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
denis
2026-10-16 21:25:48 +02:00
parent 7eb508380a
commit 1e94840abd
26 changed files with 742 additions and 37 deletions
+11 -2
View File
@@ -16,14 +16,17 @@ DEBUG = False
SECRET_KEY = _required("PYQUEST_SECRET_KEY")
ALLOWED_HOSTS = _required("PYQUEST_ALLOWED_HOSTS").split(",")
# MariaDB (ou MySQL) : pilote `mysqlclient` (voir backend/requirements-prod.txt), jeu de caractères utf8mb4.
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"ENGINE": "django.db.backends.mysql",
"NAME": _required("PYQUEST_DB_NAME"),
"USER": _required("PYQUEST_DB_USER"),
"PASSWORD": _required("PYQUEST_DB_PASSWORD"),
"HOST": os.environ.get("PYQUEST_DB_HOST", "127.0.0.1"),
"PORT": os.environ.get("PYQUEST_DB_PORT", "5432"),
"PORT": os.environ.get("PYQUEST_DB_PORT", "3306"),
"OPTIONS": {"charset": "utf8mb4"},
"CONN_MAX_AGE": 60,
}
}
@@ -32,3 +35,9 @@ SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
SECURE_SSL_REDIRECT = True
SECURE_HSTS_SECONDS = 31536000
SECURE_CONTENT_TYPE_NOSNIFF = True
# Origine publique exacte (https://domaine) : requise pour les formulaires POST (connexion) derrière le proxy.
CSRF_TRUSTED_ORIGINS = [_required("PYQUEST_ORIGIN")]
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
TRUST_REAL_IP_HEADER = True # nginx écrase X-Real-IP (voir nginx/pyquest.conf.example)