Files
RosterChief/pyproject.toml
Bernard Siebens e5a93194bf Make the app deployable: Postgres, shared cache, S3, HTTPS
Three things would have broken a deploy, all invisible until it happened:

- psycopg was missing. dj-database-url parses postgres:// happily, so the app
  would have started and died on its first query.
- No CACHES, so Django used LocMemCache -- private to one process. waffle caches
  each flag's targeting there, so under several gunicorn workers a toggle flipped
  in the control panel flushes ONE worker and the others keep serving the stale
  flag. That is a feature that "sometimes doesn't turn on", and it makes Redis a
  requirement of the first multi-worker deploy, not of the second server.
- Uploads (club logos) sat on local disk. Fine on one box; on two, a logo
  uploaded to node A 404s on node B. Storage now switches to S3 the moment a
  bucket is configured, so adding a server stays a config change.

HTTPS behind a proxy: SECURE_PROXY_SSL_HEADER is not optional once Caddy
terminates TLS -- without it Django thinks every request is plain HTTP,
request.is_secure() is false, WebAuthn disagrees with the browser about the
origin, and SECURE_SSL_REDIRECT turns into a loop. HSTS covers subdomains,
because every club is one.

The SSL/cookie flags default to off and are switched on by the production
environment on purpose: defaulting them to `not DEBUG` would redirect every test
request to https and break the suite wherever DEBUG is unset. `check --deploy` is
what catches a deploy that forgot them.

Static files are served by WhiteNoise from the app itself, so a second app server
needs no shared volume or CDN. Manifest storage is production-only: it demands a
collectstatic manifest that no test run has.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-14 09:37:36 +02:00

63 lines
1.7 KiB
TOML

[project]
name = "rosterchief"
version = "0.1.0"
requires-python = ">=3.14"
dependencies = [
"dj-database-url>=3.1.2",
"django>=6.0.6",
"django-allauth[mfa]>=65.18.0",
"django-lucide",
"django-phonenumber-field[phonenumbers]>=8.4.0",
"django-redis>=7.0.0",
"django-storages[s3]>=1.14.6",
"django-waffle>=5.0.0",
"gunicorn>=26.0.0",
"pillow>=12.3.0",
"psycopg[binary]>=3.3.4",
"python-dateutil>=2.9.0.post0",
"python-decouple>=3.8",
"weasyprint>=69.0",
"whitenoise>=6.12.0",
]
[dependency-groups]
dev = [
"coverage>=7.15.0",
"django-browser-reload>=1.21.0",
"ruff>=0.15.17",
]
[tool.ruff]
line-length = 250
target-version = "py314"
# Auto-generated migrations are not hand-maintained code.
extend-exclude = ["**/migrations/*"]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"UP", # pyupgrade
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"DJ", # flake8-django
"RUF", # ruff-specific rules
]
ignore = [
"RUF012", # Django/Wagtail model attrs (panels, Meta.ordering, ...) are framework conventions, not mutable defaults to guard.
"RUF005", # Wagtail's `Page.content_panels + [...]` concatenation is the documented idiom.
]
[tool.ruff.lint.per-file-ignores]
# Settings legitimately use star imports and long generated values.
"rosterchief/settings/*" = ["F403", "F405", "E501"]
[tool.ruff.lint.isort]
known-first-party = [
"billing", "authentication", "club", "members", "teams", "events", "formbuilder", "shop", "controlpanel", "news", "pages", "home", "search", "rosterchief"]
[tool.uv.sources]
django-lucide = { git = "https://github.com/bsiebens/lucide" }