5

I deployed a Django app on Heroku. I have some models and inserted some data to the database (SQLite database). But, when I tried to access the data after certain time, it showing an empty database. I found a problem similar to my issue here ->django heroku media files 404 error and I understood that, I should keep my Media files somewhwere else.

Here my problem is with database and my question is, can I prevent my SQLite database from this data loss ?

Harald Nordgren
  • 11,693
  • 6
  • 41
  • 65

1 Answers1

7

There is nothing you can do about this, short of storing the database on some other service like Amazon S3. Heroku has ephemeral storage: https://devcenter.heroku.com/articles/sqlite3#disk-backed-storage

However, Heroku also comes with free persistent PostgreSQL. So I would advice you to use that instead.

Harald Nordgren
  • 11,693
  • 6
  • 41
  • 65