Django Heroku Error “Your models have changes that are not yet reflected in a migration”

前端 未结 3 666
北荒
北荒 2020-12-28 18:49

I recently added a model to my app (UserProfile) and when I pushed the changes to Heroku, I think I accidentally ran heroku run python manage.py makemigrations.

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-28 19:26

    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

提交回复
热议问题