首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >更新Django版本,在已安装的“内容类型”应用程序中提供冲突的迁移

更新Django版本,在已安装的“内容类型”应用程序中提供冲突的迁移
EN

Stack Overflow用户
提问于 2022-03-18 12:47:59
回答 1查看 152关注 0票数 0

我刚从Django 2.2.6升级到4.0.3。

当我尝试在本地运行我的应用程序时,我看到:

代码语言:javascript
运行
复制
You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.

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

代码语言:javascript
运行
复制
CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0001_initial 2, 0002_remove_content_type_name, 0002_remove_content_type_name 2 in contenttypes; 0001_initial 2, 0002_alter_permission_name_max_length 2, 0003_alter_user_email_max_length 2, 0004_alter_user_username_opts 2, 0005_alter_user_last_login_null 2, 0006_require_contenttypes_0002 2, 0007_alter_validators_add_error_messages 2, 0008_alter_user_username_max_length 2, 0009_alter_user_last_name_max_length 2, 0010_alter_group_name_max_length 2, 0011_update_proxy_permissions 2, 0012_alter_user_first_name_max_length, 0012_alter_user_first_name_max_length 2 in auth; 0001_initial, 0001_initial 2 in sessions; 0001_initial 2, 0002_logentry_remove_auto_add 2, 0003_logentry_add_action_flag_choices, 0003_logentry_add_action_flag_choices 2 in admin).
To fix them run 'python manage.py makemigrations --merge'

如果我试图运行merge命令,我会得到:

代码语言:javascript
运行
复制
ValueError: Could not find common ancestor of ['0001_initial', '0001_initial 2']

它似乎来自内置的内容类型应用程序:

代码语言:javascript
运行
复制
python ./manage.py  showmigrations contenttypes
contenttypes
 [ ] 0001_initial 2
 [X] 0001_initial
 [X] 0002_remove_content_type_name
 [ ] 0002_remove_content_type_name 2

如何编辑内置应用程序的迁移?我想删除重复迁移,以便在部署我的应用程序时不会损坏我的prod服务器,但在任何地方都找不到。请帮助我:)

EN

回答 1

Stack Overflow用户

发布于 2022-04-20 14:31:34

尝试删除您的virtualenv,安装新的,并安装所有软件包。我的问题已经解决了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71527253

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档