Issue with SQLite Database Persistence in Replit Deploymentt

I hope this message finds you well. I recently purchased the Replit package to deploy my Python Flask application, and I’ve been using SQLite as the database for my application. However, I’ve encountered an issue.

Every time I update my code and restart the application, it seems to create a new SQLite database, and my previous database is no longer accessible. I need a solution to ensure that my database persists even after code updates and restarts.

Is there a recommended approach or configuration to avoid losing data when deploying updates to my Flask application on Replit?

I appreciate your assistance in resolving this matter

Hi @punisher8376 , welcome to the forums!
I’m afraid deployments don’t have persistent file systems yet, so writing data to them won’t work.
You can, however, use external databases. See Google’s free Cloud Firestore. I’ve used it before and it is an easy, reliable and safe databse to use.

Or better, you can use the Neon PostgreSQL database provided by Repl.
https://docs.replit.com/hosting/databases/postgresql-on-replit

1 Like