Rationale and recipe for developing and deploying webapps with Python and linux.
Components
- SSL and Proxy: Nginx – SSL endpoint, proxy to Django application
- Backend: Django – running via gunicorn
- Frontend: TS static files, compiled by Vite, served by Django Whitenoise (not Nginx)
- Worker: DjangoQ
- Python: uv and venv
- Frontend: Vite builder with React and/or TS
I’ve tried lots of combos of these settled on these, because of my viewpoints:
- Nginx is non-container because it is part of server infrastructure. It handles ONLY revproxy, ssl and multi-host.
- Webapp TS is served by Django Whitenoise as it’s a application (not infrastructure) concern
- Worker is DjangoQ (not Celery) as it integrates easily with Django
- uv as it’s is better than poetry
- Vite and React as they seem good (less experience here).
Development
- Develop on local machine (i.e. a project/ folder and .venv python) without containers
- This is a pragmatic decision balancing less setup with dev versus deploy drift
- Container ONLY for db, redis, etc.
Deployment
- No github actions, etc as slow. Maybe for larger teams.
- Makefile creates the Images and folder of auxiliiary files (init-db, etc), then copies to server where the images are installed.
- Quadlets to define *.container files (not podman compose)
- Webapp runs as user (not root).