I would like to have a local copy of the data in the Django database to facilitate offline development. The production version is hosted by Heroku; the data is stored in a Postgres database and I am using foreman locally with the default mysqlite database.
Asked
Active
Viewed 287 times
2 Answers
0
Enable the Django REST framework and get each object using requests. At this point the data can be inserted into the local copy using the object create method.

Peter H
- 83
- 1
- 6
0
This is easily done by exporting a backup from Heroku's pgbackup application, which can be done either through your dashboard or by going to your repo's root directory and running the following:
$ heroku pg:backups capture # to capture snapshot of current db
$ curl -o latest.dump `heroku pg:backups public-url`
You now have a Postgres dump file that can populate from an empty db on your local Postgres server. Most simply is to use PGAdmin and Load From Restore.
More info here.
-
I am using the sqlite DB locally but certainly turning up a Postgres DB on my laptop might be worthwhile. – Peter H May 02 '16 at 17:02