Heroku生产环境部署Django博客:SQLite是否适用?免费Postgres够用吗?
Hey there! Great job pushing through tutorials and docs to get your Django app ready for deployment—grind like that pays off, so props for sticking with it. Let’s break down your two questions clearly:
1. Is using SQLite in production (on Heroku) a valid choice?
Short answer: No, it’s not a practical or reliable option for production on Heroku, even with your small user base. Here’s why:
- Heroku’s dynos use an ephemeral filesystem. Every time your app restarts (which happens regularly—dynos sleep after 30 mins of inactivity, or when Heroku updates its infrastructure), any changes to the SQLite database file will be wiped. That means the articles/announcements your single user posts will disappear randomly, which is obviously a dealbreaker.
- SQLite is built for low-concurrency, single-user scenarios (like local development). Even with just one author and read-only visitors, it doesn’t handle concurrent connections as smoothly as client-server databases like Postgres.
Heroku’s docs call this out for a reason—SQLite simply isn’t designed to work with the way Heroku hosts apps. It’s perfect for local testing, but production needs a persistent database solution.
2. Will the free Postgres plan meet your needs?
Absolutely! Let’s match your use case to the free plan’s limits:
- You only have one user creating content, and visitors only read. That’s extremely low traffic and minimal data volume. The free Heroku Postgres plan comes with 1GB of storage—enough to hold thousands of articles/announcements, even with basic media (though you might want to store images separately to keep the database lean).
- Concurrent connections: Since your visitors are only reading, and there’s just one author posting, you’ll never hit the connection limit of the free plan.
- The only tiny catch is that free Heroku Postgres databases can hibernate if unused for a while, but waking them up takes just a few seconds—your visitors might see a tiny one-time delay, but it’s negligible for your scenario.
So go ahead and set up the free Postgres add-on for your Heroku app—it’s exactly what you need right now.
内容的提问来源于stack exchange,提问作者Mowli sri

