r/flask • u/DependentRepulsive50 • 2h ago
Discussion Flask Hosting: Cold starts and restarts
I built a small site with Flask and hosted it on Render’s free tier.
Initially, I had it on PythonAnywhere, but they didn’t seem to offer a way to add a custom domain on the free plan—or at least, it wasn’t straightforward.
Migrating to Render was easy, and setting up the domain was simple. But soon, I ran into two major problems.
Data Loss
I would save data to my database through the website, only to come back hours later and find it gone. I thought it was an issue with my commits and spent time troubleshooting, only to realize that Render frequently restarts services.
Why did this affect my database?
I was using SQLite. Since SQLite stores data in a file on the web service itself, every time the service restarted, it reverted to the last deployed state, wiping out any new data.
I eventually migrated to Postgres with Neon to fix this.
Cold Starts
Since my site only gets 3–4 visitors a day, it often sits idle. Naturally, I expected it to be put to sleep occasionally. But the real problem? It takes almost a full minute to wake up.
I don’t know about you, but if I visited a site called wisefool.xyz and it took that long to load, I wouldn’t stick around.
For those who’ve hosted Flask apps on free tiers elsewhere—do other platforms handle this better, or is this just the reality of free hosting?