django heroku makemigrations忽略了模型的变化

时间:2017-04-28 22:07:48

标签: python django heroku django-models heroku-postgres

我从models.py中删除了两个模型,当我运行makemigrations并在本地迁移时,一切都很好。当我在Heroku上运行makemigrations时,我收到以下消息,其中Building和BuildingInstance是我删除的模型:

Migrations for 'hello':
0002_building_buildinginstance.py:
- Create model Building
- Create model BuildingInstance

当我运行迁移时,我得到:

Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

我按照here步骤操作,并尝试按照建议here在本地和Heroku上压缩迁移。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

正如我在这里多次写过的那样,你一定不能在Heroku上运行makemigrations。在本地运行,提交结果,然后在Heroku上运行migrate。