执行python manage.py makemigrations时出现以下错误

D:\autotestplat>python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "D:\Program Files\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
utility.execute()
File "D:\Program Files\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\Program Files\Python\Python37-32\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "D:\Program Files\Python\Python37-32\lib\site-packages\django\core\management\base.py", line 335, in execute
output = self.handle(*args, **options)
File "D:\Program Files\Python\Python37-32\lib\site-packages\django\core\management\commands\makemigrations.py", line 78, in handle
loader = MigrationLoader(None, ignore_no_migrations=True)
File "D:\Program Files\Python\Python37-32\lib\site-packages\django\db\migrations\loader.py", line 49, in __init__
self.build_graph()
File "D:\Program Files\Python\Python37-32\lib\site-packages\django\db\migrations\loader.py", line 267, in build_graph
raise exc
File "D:\Program Files\Python\Python37-32\lib\site-packages\django\db\migrations\loader.py", line 241, in build_graph
self.graph.validate_consistency()
File "D:\Program Files\Python\Python37-32\lib\site-packages\django\db\migrations\graph.py", line 243, in validate_consistency
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "D:\Program Files\Python\Python37-32\lib\site-packages\django\db\migrations\graph.py", line 243, in <listcomp>
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "D:\Program Files\Python\Python37-32\lib\site-packages\django\db\migrations\graph.py", line 96, in raise_error
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration apitest.0001_initial dependencies reference nonexistent parent node ('product', '0001_initial')

问题原因:由于'product' 应用下的'0001_initial'文件不存在,而在 apitest应用下的0001_initial 文件中引用了product中的迁移记录

问题解决:删除 apitest->migrations下的0001_initial .py文件,再重新执行命令

django.db.migrations.exceptions.NodeNotFoundError: Migration apitest.0001_initial dependencies reference nonexistent parent node ('product', '0001_initial')的更多相关文章

  1. 使用django执行数据更新命令时报错:django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency users.00 01_initial on database 'default'.

    如果在重新封装更新用户表之前,已经更新了数据表,在数据库中已经有了django相关的依赖表,就会报错: django.db.migrations.exceptions.InconsistentMigr ...

  2. django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applie

    Traceback (most recent call last): File "manage.py", line 15, in <module> execute_fr ...

  3. 替换django的user模型出现的异常django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency users.0001_initial on database 'default'

    django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applie ...

  4. django.db.migrations.exceptions.BadMigrationError: Migration tests in app bl

    这个错误基本上都是 替换文件后才会出现的问题 因为你替换后他的日志文件没有完全替换的话,那么日志对应不到就会出现这样的问题, 一个模糊的处理办法:重新进行数据迁移:首先删除migrations中除去_ ...

  5. 报错django.db.migrations.exceptions.InconsistentMigrationHistory

    Pycharm强大的功能总是让我很是着迷,比如它的makemigrations 和 migrate. 然而某一次,当我再次敲下这熟悉的命令时,它报错了.... Traceback (most rece ...

  6. django.db.migrations.exceptions.MigrationSchemaMissing和raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)

    1.使用Python3.7 + Django2.2 + MySQL 5.5 在执行(python manage.py migrate)命令时出现错误django.db.migrations.excep ...

  7. Django db relationship

    # coding=utf-8 from django.db import models """ Django数据库关系: 一对一关系:OneToOneField 多对多关 ...

  8. django.db.utils.ProgrammingError: 1146 的解决办法

    在models中设置完数据库相关的东西后执行命令 python manage.py makemigrations 此处无错误 再次执行 python manage.py migrate 发生报错 错误 ...

  9. DB Migrations更新数据库命令

    在项目迭代的过程中,数据库结构常常需要跟随业务需求的变化做出调整,尤其在迭代的初期阶段,加一个字段减一个字段的需求更是家常便饭.在小型团队中,往往是负责开发功能模块的程序员在完成本地开发环境数据库的变 ...

  10. 迁移文件是报错 django.db.utils.InternalError: (1054, "Unknown column 'name' in 'django_content_type'")

    相信大家在做django迁移时有可能会遇到这样的错误- django.db.utils.InternalError: (1054, “Unknown column ‘name’ in ‘django_ ...

随机推荐

  1. 2_JDBC

    一. 引言 1.1 如何操作数据库 使用客户端工具访问数据库, 需要手工建立连接, 输入用户名和密码登陆, 编写SQL语句, 点击执行, 查看操作结果(结果集或受行数影响) 1.2 实际开发中, 会采 ...

  2. 1_Layui

    一. 引言 官网: https://www.layui.com/ 在官网首页, 可以很方便的下载Layui Layui是一款经典模块化前端UI框架, 我们只需要定义简单的HTML,CSS,JS即可实现 ...

  3. .net程序员的android studio 初体验 (环境设置2022年10月)

      很久以前用DevExtreme写的一个Hybird APP要添加蓝牙打印功能,但是用来打包APP的phonegap被adobe关闭了,所以,只能自己用cordova去打包安卓APP,不得已,研究了 ...

  4. 云原生强大且灵活的持续集成CI开源框架Tekton实战-上

    @ 目录 概述 定义 常见CICD工具 使用好处 组件 基本概念 安装 前提条件 安装Tekton Pipelines 创建并运行任务 安装Dashboard 安装Cli Pipelines示例演示 ...

  5. Multi-View Intent Disentangle Graph Networks for Bundle Recommendation解读

    简要论述 bundle recommendation 的目的是向user推荐一个整体的bundle package about items.以前的模型捕获了user对item and item关联的偏 ...

  6. KubeEdge SIG AI发布首个分布式协同AI Benchmark调研

    摘要:AI Benchmark旨在衡量AI模型的性能和效能. 本文分享自华为云社区<KubeEdge SIG AI发布首个分布式协同AI Benchmark调研>,作者:KubeEdge ...

  7. JavaScript基本语法(函数与对象)

    3.函数 #①内置函数 内置函数:系统已经声明好了可以直接使用的函数. #[1]弹出警告框 alert("警告框内容");   #[2]弹出确认框 用户点击『确定』返回true,点 ...

  8. Java I/O(3):NIO中的Buffer

    您好,我是湘王,这是我的博客园,欢迎您来,欢迎您再来- 之前在调用Channel的代码中,使用了一个名叫ByteBuffer类,它是Buffer的子类.这个叫Buffer的类是专门用来解决高速设备与低 ...

  9. Linux基础_2_bash功能

    查看当前shell:echo  $SHELL 查看可用shell:cat  /etc/shells 命令行编辑 光标跳到行首:Ctrl+a 光标跳到行尾:Ctrl+e 以单词为单位快速跳转光标:Ctr ...

  10. 齐博x1标签实例:标签设置取组图不存在就取内容中的图片

    对于CMS或者是其它,使用下面的代码 <div class="morepic"> {volist name=":getArray($pics=$rs.picu ...