Reputation: 1135
I'm getting this error. I know you usually get this error because the databases wasn't properly migrated.
When I run heroku local web
, the website works fine when I go to localhost:5000
.
However after I deploy the app to heroku with git push heroku master
, the error comes up.
In other words, it works in my local environment. But it does not work after deploying to heroku.
I have Heroku-Postgres installed as an add-on in heroku.
What could be causing this?
Upvotes: 4
Views: 4889
Reputation: 2110
The following steps did it for me
python manage.py makemigrations
) and migrate (python manage.py migrate
) locally,heroku run python manage.py migrate
Solved the issue
Upvotes: 1
Reputation: 96
I experienced the same error after making a change to a model and then deploying this change to heroku.
The only way I managed to fix this problem was to do the following:
__init__.py
file)python manage.py makemigrations
and python manage.py migrate
. This will repopulate the migrations folder with clean migration files..gitignore
files.heroku run bash
python manage.py migrate
I was able to do this because my tables did not have much data in, but I would try to avoid resetting the database if I had more data in my tables.
Upvotes: 0
Reputation: 330
excute migrations and makemigrations in bash heroku. open the terminal in the local project folder and give the following commands:
heroku run bash
~$ ./manage.py makemigrations
~$ ./manage.py migrate
~$ exit
Upvotes: 5