繁体   English   中英

django 在生产中未运行特定迁移(已跳过)

[英]django doesnt run a specific migration (it skipped) in production

当我运行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的迁移名称:

./manage.py migrate users 0002_remove_profile_image.py

但正确的用法是没有它,所以只需删除它:

./manage.py migrate users 0002_remove_profile_image

或者只是简写:

./manage.py migrate users 0002

对不起这是我的错。 我正在使用heroku run我应该先在本地运行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM