Django Heroku Error "Your Models Have Changes That Are Not Yet Reflected In A Migration"
Solution 1:
You need to first create the migrations locally, add them to your repository, commit the files with the new migrations and then push to heroku.
The sequence is something like this:
1. (add/modify some someapp/models.py)
2. python manage.py makemigrations someapp
3. python manage.py migrate
4. git add someapp/migrations/*.py (to add the new migration file)
5. git commit -m "added migration for app someapp"
6. git push heroku
7. heroku run python manage.py migrate
Solution 2:
- Make migrations locally
$ python manage.py makemigrations && python manage.py migrate
- Commit changes and push it on the server
$ git add --all
$ git commit -m "Fixed migrate error"
$ git push heroku master
- Now run migrate on the server
$ heroku run python manage.py migrate
You also need to be sure that you haven't ignored these migration paths in your .gitingnore file
Solution 3:
It sounds like you ran makemigrations
after you made changes to your model but before you had an initial migration file. Try to revert your app to the state it was before you added the new model and run makemigrations
again to create the initial migration. Then add your updates back in and run makemigrations
once more. This will create a second migration from your initial data structure to the new updated one. Then try your deployment.
https://docs.djangoproject.com/en/1.7/topics/migrations/#adding-migrations-to-apps
Post a Comment for "Django Heroku Error "Your Models Have Changes That Are Not Yet Reflected In A Migration""