Dockerize Django app with dev/beta/prod env config and uv #6

Merged
westfarn merged 5 commits from feature/4-dockerize-with-env-config into master 2026-07-07 11:23:50 -07:00
Owner

Summary

  • Containerize the Django app with Docker and docker-compose (dev + production)
  • Refactor settings into dev / beta / prod environments driven by environment variables
  • Connect to PostgreSQL via DATABASE_URL or DB_* vars
  • Migrate package management from pip to uv (pyproject.toml, uv.lock)
  • Split Gitea workflows: PRs run unit tests only; pushes to master run tests, Docker validation, and deploy
  • Update deploy script to rsync code, preserve server .env, validate config, and run Docker compose

Closes #4

Test plan

  • uv run python manage.py test passes locally (10/10)
  • DJANGO_ENV=beta and DJANGO_ENV=prod load with correct logging levels
  • scripts/validate-env.sh rejects missing production variables
  • docker compose up --build starts app + Postgres locally
  • Containerized unit tests pass in CI Docker job
  • Server .env created from .env.prod.example before first production deploy
  • CI workflow runs on this PR (tests only, no deploy)
## Summary - Containerize the Django app with Docker and docker-compose (dev + production) - Refactor settings into `dev` / `beta` / `prod` environments driven by environment variables - Connect to PostgreSQL via `DATABASE_URL` or `DB_*` vars - Migrate package management from pip to uv (`pyproject.toml`, `uv.lock`) - Split Gitea workflows: PRs run unit tests only; pushes to `master` run tests, Docker validation, and deploy - Update deploy script to rsync code, preserve server `.env`, validate config, and run Docker compose Closes #4 ## Test plan - [x] `uv run python manage.py test` passes locally (10/10) - [x] `DJANGO_ENV=beta` and `DJANGO_ENV=prod` load with correct logging levels - [x] `scripts/validate-env.sh` rejects missing production variables - [ ] `docker compose up --build` starts app + Postgres locally - [ ] Containerized unit tests pass in CI Docker job - [ ] Server `.env` created from `.env.prod.example` before first production deploy - [ ] CI workflow runs on this PR (tests only, no deploy)
westfarn force-pushed feature/4-dockerize-with-env-config from b5275f1b7e to faca7b1084 2026-07-03 04:17:08 -07:00 Compare
westfarn added 1 commit 2026-07-07 04:00:21 -07:00
Dockerize Django app with dev/beta/prod env config and uv.
CI / test (pull_request) Successful in 11s
Unit Tests / test (pull_request) Failing after 6s
115c5ae319
Replace hardcoded settings with environment-driven config, add Docker
compose for local and production deploys, migrate from pip to uv, and
split Gitea workflows so PRs run tests only while master pushes deploy.
westfarn force-pushed feature/4-dockerize-with-env-config from faca7b1084 to 115c5ae319 2026-07-07 04:00:21 -07:00 Compare
westfarn added 1 commit 2026-07-07 09:20:21 -07:00
g
CI / test (pull_request) Successful in 10s
Unit Tests / test (pull_request) Successful in 10s
a4b37a0bb0
westfarn added 1 commit 2026-07-07 11:11:27 -07:00
fix(static): tolerate missing asset references in collectstatic
CI / test (pull_request) Successful in 10s
Unit Tests / test (pull_request) Successful in 10s
5899c1f14f
WhiteNoise's manifest storage strictly resolves every referenced file
during collectstatic, including sourceMappingURL comments in vendored
JS bundles. A missing .map (financial/js/.../dashboard-free.js.map)
broke the prod container at startup. Add TolerantManifestStaticFilesStorage
which leaves unresolved references untouched instead of raising.

Co-authored-by: Cursor <cursoragent@cursor.com>
westfarn added 1 commit 2026-07-07 11:14:00 -07:00
fix(settings): accept JSON-array env lists in env_list
CI / test (pull_request) Successful in 10s
Unit Tests / test (pull_request) Successful in 9s
5d378b7b19
The production .env stores DJANGO_ALLOWED_HOSTS as a JSON array (legacy
format), but env_list only split on commas, yielding broken entries like
'["aimloperations.com"' and causing DisallowedHost (HTTP 400) for every
request. Parse JSON arrays as well as comma-separated values.

Co-authored-by: Cursor <cursoragent@cursor.com>
westfarn added 1 commit 2026-07-07 11:18:51 -07:00
fix(static): don't 500 on missing manifest entries at runtime
CI / test (pull_request) Successful in 10s
Unit Tests / test (pull_request) Successful in 9s
d2f2409a53
Templates reference public/img/logo.png (favicon, brand logo, social
share images) which isn't present in the repo. With the strict manifest
storage this raised ValueError at request time -> HTTP 500. Override
stored_name (and set manifest_strict=False) to fall back to the plain
name so a missing static degrades to a broken asset instead of a 500,
matching the previous non-manifest behaviour.

Co-authored-by: Cursor <cursoragent@cursor.com>
westfarn merged commit 426cc82f04 into master 2026-07-07 11:23:50 -07:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/company_site#6