as2d3
as2d3

Reputation: 905

Pulling data from heroku for django website

I made a website on django and hosted it on heroku. It uses the default sqlite3 database.

When adding some entry on the website, the heroku db is updated. I am unable to pull that entry on my local db.

When I push any changes to the heroku, all those entries that were added from the website are deleted.

How can I pull those entries from heroku?

Upvotes: 0

Views: 83

Answers (1)

Max Schubmann
Max Schubmann

Reputation: 11

When you push your changes to Heroku, you are also pushing your SQLite3 database file, which overwrites the changes that were done to it on the Heroku server.

If you want the database to stay the same, dont add it to your commits when you push to Heroku.

As Daniel said, you should just switch to a free Heroku PostgreSQL database instead of using SQLite3. This way you can download the Heroku database onto your local system via backup/restore and any changes you push to Heroku won't overwrite the existing data in the database.

You can find instructions on how to implement Heroku PostgreSQL into your django application here: https://devcenter.heroku.com/articles/heroku-postgresql#connecting-with-django

Upvotes: 1

Related Questions