Migrate Django development database (.sql3) to Heroku

amazon-s3, django, migrate, postgresql, sqlite

Solution

Perhaps there may be a way to directly upload an sql3 file to Heroku, but I went with the path of clearest certainty (convert local sql3 db to postgre db and upload a dump of postgre db to Heroku via pgbackups tool):

- Create a dump of your sql3 database as a json file

- With PostgreSql installed and with its `bin` directory in the `Path` environment variable, create a postgre user and database (or just plan on using your initial super user account created upon installing postgresql)

- Update your `settings.py` with a reference to your newly created postgre database (note, `'HOST'` may need to be set as `'localhost'`, `'user'` is your postgre user login)

- run `python manage.py syncdb` to initiate your new postgre db

- Optional: if necessary, truncate your postgre db of contenttypes

- load your dump from step 1 (if you have fixture issues, see here)

- Now you have a working postgre local db. To migrate, first create a postgre dump

- Post your postgre dump somewhere accessible by URL (such as drop box or amazon s3 as suggested in previous link).

- Perform pgbackups restore command, referencing your dump url

- Your heroku app should now reference the contents of your local db.

Problem

How does one migrate their Django .sql3 development database to heroku? Per here, and here I tried: `heroku pg:psql --app sblic < database.sql3` but my Django admin shows no new uploads (even after syncdb/migrate/ or collectstatic

Original source

Related problems