-1

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.

Peter H
  • 83
  • 1
  • 6

2 Answers2

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.

nograpes
  • 18,623
  • 1
  • 44
  • 67
Ian Price
  • 7,416
  • 2
  • 23
  • 34
  • 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