Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
851 views
in Technique[技术] by (71.8m points)

sqlite - Heroku: Django database file lost on every dyno restart

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 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...