简体   繁体   中英

Django 1.8 migrating data from local database to heroku database

I first tried using heroku addons:add pgbackups but heroku docs say that it has been deprecated. The instead recommended using this command as specified here

PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser  mydb > mydb.dump

But this throws the following error-

'PGPASSWORD' is not recognized as an internal or external command,
 operable program or batch file.

I have already existing data on my local database and want to transfer those data into the heroku database. Any way to make this work or is there some other way?

You could try fixtures

To create the JSON file from your local database:

python manage.py dumpdata > a_fixture_file.json

Take that file to the server. Be sure your server database has the same migrations. Then

python manage.py loaddata a_fixture_file.json

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM