Home > database >  Django data was not brought to heroku
Django data was not brought to heroku

Time:11-18

I have Django apps, which include users and posts models. The apps work perfectly at local following making migrations and migrating. I tried two different ways to deploy the apps to Heroku. First, using Heroku Git, the apps works on Heroku the same as at local.

When using GitHub, however, all data were not brought to Heroku. I tried to run "python manage.py makemigrations" and "python manage.py migrate" on Heroku, but the data from local was not brought still.

I would really appreciate it if you could please explain and help with the issue using GitHub.

CodePudding user response:

I think you have to migrate on Heroku as well, try:

heroku run python manage.py migrate

See the heroku docs

CodePudding user response:

check your .gitignore file maybe db.sqlite in gitignore file and you can remove it another option is dumpdata and load in production you can run

python3 manage.py dumpdata > data.json

and load data in production

python3 manage.py loaddata data.json
  • Related