from pathlib import Path

from .base import *  # noqa: F403
from .base import BASE_DIR, MIDDLEWARE


DEBUG = False
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True

# Serve admin/static behind gunicorn with DEBUG=False (no nginx static mount needed).
# WhiteNoise sits right after SecurityMiddleware.
MIDDLEWARE = (
    MIDDLEWARE[:1]
    + ["whitenoise.middleware.WhiteNoiseMiddleware"]
    + MIDDLEWARE[1:]
)

STATIC_ROOT = Path(BASE_DIR) / "staticfiles"
STORAGES = {
    "default": {"BACKEND": "django.core.files.storage.FileSystemStorage"},
    "staticfiles": {"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage"},
}
