【发布时间】:2016-04-17 13:43:53
【问题描述】:
我在 Heroku 上部署了一个新的 django 应用程序,效果很好。但是,今天我稍微更改了我的模型(添加了一个新字段),然后删除了我的开发服务器文件 db-sqlite3 和迁移文件夹,以反映开发数据库中的更改。这在本地服务器上运行良好,但是当我将其推送到 heroku 时,尝试访问 django-admin 部分中的模型时出现 500 错误。
我尝试通过 heroku 运行一些迁移,但收到以下错误消息:
! These migrations are in the database but not on disk:
<joins: 0002_auto__add_field_join_ip_address>
<joins: 0003_auto__add_unique_join_email>
<joins: 0004_auto__add_field_join_ref_id>
<joins: 0005_auto__add_unique_join_email_ref_id>
<joins: 0006_auto__add_unique_join_ref_id>
<joins: 0007_auto__del_unique_join_ref_id>
<joins: 0008_auto__del_unique_join_email__add_unique_join_ref_id>
<joins: 0009_auto__add_field_join_friend>
! I'm not trusting myself; either fix this yourself by fiddling
! with the south_migrationhistory table, or pass --delete-ghost-migrations
! to South to have it delete ALL of these records (this may not be good).
(lwc) Daniels-MacBook-Pro:src danielrichter$ heroku run python manage.py migrate --delete-ghost-migrations
我可以看到,在我的本地迁移文件夹中,我只有 0001_initial 迁移并且不知何故错过了另一个,但我不知道如何解决这个问题。
我看到其他人遇到相同的错误消息,但我不理解建议的答案,因为我对 Django 和一般编码都很陌生。因此,如果有人可以给我提示如何解决这个问题,我将非常感激!
非常感谢!
【问题讨论】:
标签: django database heroku django-models migration