Search code examples
sqliteflaskheroku

The Backend Flask Server hosted on heroku, resets the sqlite DB.?


I've hosted my flask backend server for my web app, once the heroku servers are up the server works fine but once we access the system after a while the DB resets to initial state and all the data entered is lost. I am using sqlite DB using SQLAlchemy on Flask for DB.


Solution

  • The way it works is that your dyno will reset at least once per day and in doing so it will reset all your file to its initial state. To fix this you will need to use Heroku Postgres. Here is a great tutorial showing you how to do this:

    https://medium.com/analytics-vidhya/heroku-deploy-your-flask-app-with-a-database-online-d19274a7a749