django heroku makemigrations忽略了模型的更改 [英] django heroku makemigrations ignoring changes in models

查看:131
本文介绍了django heroku makemigrations忽略了模型的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I deleted two models from models.py, and when I run makemigrations and migrate locally, everything is fine. When I run makemigrations on Heroku, I get the following message, where Building and BuildingInstance are the models I deleted:

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.

我遵循了这里.我该如何解决这个问题?

I followed the steps here and also tried squashing the migrations locally and on Heroku as suggested here. How can I fix this problem?

推荐答案

正如我在这里多次写的那样,您一定不要在Heroku上运行makemigrations.在本地运行它,提交结果,然后在Heroku上运行迁移.

As I have written many times here, you must not run makemigrations on Heroku. Run it locally, commit the result, and then​ run migrate on Heroku.

这篇关于django heroku makemigrations忽略了模型的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆