Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

python - Django app on Heroku deletes objects after some time

I've written a simple Django Q&A forum app and deployed it on Heroku. The local version of the site works fine. However, the production version does not store the questions, answers etc. for more than a few hours.

I decided to stick with sqlite3 that comes with Django. I don't expect a lot of traffic to the site so I decided it would be worth it to keep the development database for now.

site: http://immense-plateau-35286.herokuapp.com

I've tried a few solutions from the DB setup page on Heroku, but have not had any success so far.

Any idea what this might be?

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

Heroku's filesystem is ephemeral. Anything you write to it will be lost anytime your dyno restarts, which happens frequently. Since SQLite stores its data in a file on the filesystem it isn't a good choice on Heroku.

Instead, consider using one of the many client-server data stores that Heroku supports. Its PostgreSQL offering works reasonably well.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...