【发布时间】:2022-01-12 06:52:46
【问题描述】:
当我运行 makemigrations 时它返回
users/migrations/0002_remove_profile_image.py
- Remove field image from profile
但是当我运行migrate users 0002.. 时,它说CommandError: Cannot find a migration matching '0002_remove_profile_image.py' from app 'users'
当我运行migrate 时,它说
No migrations to apply.
Your models in app(s): 'users' 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.
我能做什么? 我在 Heroku 上部署
【问题讨论】:
-
删除
.py,所以只需migrate users 0002_remove_profile_image或简单migrate users 0002 -
您提交迁移了吗? 始终将迁移提交到您的版本控制。我们不应该在服务器本身上生成迁移文件。此外,您的文件在 Heroku 上是短暂的,这意味着它们仅在 pod 存在之前存在(这可能是正在发生的事情)。
标签: python django heroku django-migrations