Getting data into a Django application on Heroku

You can use Django to dump data from your db and git to push the dump to heroku. If the data is sensitive you should take care to remove the data by resetting the head after loading the data in heroku. A more in depth solution can be found here.

1. Dumpdata from dev build.

python dumpdata --natural --indent 2 > data.json

2. Add data to repo and commit.

git add data.json

git commit -m "Dump data"

3. Push to Heroku.

git push heroku master

4. Load data into Heroku build.

heroku run python loaddata data.json

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s