0

My django application is working perfectly fetching and inserting data into local postgres database. Now i have data in my local postgres database. When i deployed my app on heroku and run migrate command in heroku then it create the tables. But the tables are empty.

I just want to know that Did i have to insert all my data again in heroku postgres database or there is any way to migrate/export the local postgres database with data to heroku postgres database?

3
  • Have you ever tried this? Commented Jul 18, 2020 at 5:50
  • I read that documentation, but in that they had written that we need to upload it somewhere with an HTTP-accessible URL(they had used aws s3). But can we do not do directly? Commented Jul 18, 2020 at 6:10
  • If the docs do not say so, I don't believe there are stable ways that you can. Commented Jul 18, 2020 at 6:11

1 Answer 1

1

you can use django-admin dumpdata and django-admin loaddata commands run the first command in your local machine and upload the generated file to your server and run the loaddata command on your server to restore your data further reading example docs

Sign up to request clarification or add additional context in comments.

3 Comments

When i run this command: python manage.py dumpdata > db.json File is created, but when i run this command: heroku run python manage.py loaddata db.json I got this error: System check identified some issues: WARNINGS: ?: (urls.W005) URL namespace 'admin' isn't unique. You may not be able to reverse all URLs in this namespace CommandError: No fixture named 'db' found.
it can't find your db.json file in your server check it's location and path is correct
django.core.serializers.base.DeserializationError: Problem installing fixture '/app/data.json'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.