- backup.sh: pg_dump (custom format), media volume and .env in one archive with retention (KEEP), cron example - restore.sh: confirmation, restores .env if missing, pg_restore --clean in one transaction, replaces media, restarts the app - Fix: MEDIA_ROOT=/data/media in the image so photos land on the volume - README: installation, Nginx/Cloudflare client-IP setup, configuration table, AI and Instagram notes, update, backup, troubleshooting, security - Test settings independent of the local .env Co-Authored-By: Claude Opus 5.5 <[email protected]>
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
"""Test settings: same as production, with defaults for required variables."""
|
|
|
|
import os
|
|
|
|
os.environ.setdefault("SECRET_KEY", "test-secret-key-not-for-production")
|
|
os.environ.setdefault("APP_BASE_URL", "https://kochbuch.example.test")
|
|
|
|
from .settings import * # noqa: E402,F403
|
|
|
|
STORAGES = {
|
|
**STORAGES, # noqa: F405
|
|
"staticfiles": {"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"},
|
|
}
|
|
|
|
# Static files are served by the finders in tests; no collectstatic needed.
|
|
WHITENOISE_USE_FINDERS = True
|
|
WHITENOISE_AUTOREFRESH = True
|
|
|
|
# Deterministic defaults, independent of a real .env (the Docker test service loads it).
|
|
import ipaddress # noqa: E402
|
|
|
|
OPENAI_API_KEY = ""
|
|
OPENAI_MODEL = "gpt-5-mini"
|
|
OPENAI_REASONING_EFFORT = "low"
|
|
AI_RATE_LIMIT_PER_USER_PER_DAY = 0
|
|
AI_RATE_LIMIT_GLOBAL_PER_DAY = 0
|
|
COMMENT_RATE_LIMIT_PER_HOUR = 30
|
|
LOGIN_MAX_FAILURES_PER_EMAIL = 5
|
|
LOGIN_MAX_FAILURES_PER_IP = 30
|
|
LOGIN_LOCKOUT_MINUTES = 15
|
|
IMAGE_MAX_UPLOAD_MB = 15
|
|
IMAGE_MAX_PER_RECIPE = 10
|
|
CLIENT_IP_HEADER = ""
|
|
TRUSTED_PROXIES = [ipaddress.ip_network(n) for n in ("127.0.0.0/8", "::1/128", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16")]
|