Terminal Guy
Terminal Guy

Reputation: 188

How do I put my Django SQLite database contents into a Heroku PostGreSQL database?

I am totally new to hosting/deploying applications. After watching this video, he started a new database from scratch rather than converting his Django SQLite database. I have lots of data that I want on the deployed site so I'd like some advice as to how to do that with Django and Heroku. I have seen there are some SQLite -> PostGreSQL conversion questions on here but none seemed to show a step by step guide using Django and Heroku, only issues they're having. I just want to make sure I do it right.

Upvotes: 2

Views: 926

Answers (1)

dethos
dethos

Reputation: 3454

One easy solution could be using dumpdata and loaddata management commands from Django.

For example, locally you would do:

$ python manage.py dumpdata > somefile

then on your deployment you could do:

$ python manage.py loaddata somefile

This is not the ideal solution, but for simple use cases could definitely do the trick.

Note: you would have to first upload the somefile to your server, in this case heroku.

Upvotes: 2

Related Questions