Django Failover for Cheap: Neon, Fly.io & Cloudflare
by Noah Davison
$3.99+
Railway went down at 2am while someone was using my app. I had no alerting, no failover, and no idea how long it had been broken. This guide is what I built so that wouldn't happen again — and it costs almost nothing to run.
The setup: move Postgres off Railway onto Neon so your data survives any host outage. Deploy a Fly.io standby that sleeps when idle at around ten cents a month. Run an 80-line Cloudflare Worker on a free cron trigger that detects failure, swaps DNS to the standby, and swaps back when your primary recovers. You get a Slack alert either way.
What's inside — 9 pages
Why the real problem is coupled compute and data, not which host you happened to pick
The pg_dump / psql migration playbook with row-count verification before you cut over
A Dockerfile for Django on Fly.io configured properly for scale-to-zero
The complete Cloudflare Worker source — cron trigger, KV state, DNS swap, Slack alerts, automatic failback
wrangler.toml, deploy commands, and live log tailing so you can confirm it's actually running
Extending to a second or third project: one config line per app, same Worker
An honest decision matrix comparing this against Cloudflare Load Balancing and manual failover
Before you build it
Put UptimeRobot on your endpoints and let it run two weeks. If you're already above 99.5% uptime, do the Neon migration and skip the rest until you genuinely need it. That advice is in the guide too — I'd rather you build the right amount of infrastructure than all of it.
Who this is for
Anyone running a Django app on Railway, Render or Fly who wants real reliability without enterprise pricing. Works with the stack from Guide 01, but applies to any Django deployment.
Guide 02 of the React Native + Django series. Instant PDF download.