Originally published on the Djangix blog: Deploying Django on AWS with Zero Downtime
Zero downtime on a single small server does not require Kubernetes or a second machine. The practical pattern in the full guide is blue-green on one host: keep two complete copies of your Django app, run only one of them live at a time, and let Nginx decide which one receives traffic.
In that setup each colour has its own code directory, virtual environment, Gunicorn service, and local port, while both share the same database, media storage, and environment configuration. You deploy by updating the inactive copy, running its checks and migrations carefully, starting it, and probing its health endpoint directly before any real user sees it.
Only when the new colour answers correctly do you point Nginx at its port and reload. The previous colour keeps running untouched, which is what makes rollback fast: if the new release misbehaves, switch the proxy back and reload again — no rebuild and no frantic restore while users wait.
The discipline matters as much as the tooling. Keep secrets out of either app directory, do not let collectstatic overwrite files the live colour is serving, and treat database changes that the old code cannot tolerate as a separate problem, because an instant code rollback cannot undo an incompatible migration.
Full article: Deploying Django on AWS with Zero Downtime
Top comments (0)