执行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. 【JAVA】普通IO数据拷贝次数的问题探讨

    最近看到网上有些文章在讨论JAVA中普通文件IO读/写的时候经过了几次数据拷贝,如果从系统调用开始分析,以读取文件为例,数据的读取过程如下(以缓存I/O为例): 应用程序调用read函数发起系统调用, ...

  2. sql语句的组成

    数据定义语言(DDL,Data Definition Language):包括CREATE(创建)ALTER(修改)DROP(删除)等. 数据操纵语言(DML,Data Manipulation La ...

  3. spark之交集并集差集拉链

    spark之交集并集差集拉链 def main(args: Array[String]): Unit = { val sparkConf = new SparkConf().setMaster(&qu ...

  4. jsp和java的结合使用显示学生信息

    package com.zyz; public class Student { private String ID; // 学号 private String name; // 姓名 private ...

  5. 【神经网络】softmax回归

    前言 softmax回归为一种分类模型. 基本原理 由于softmax回归也是一种线性叠加算法,且需要输出离散值. 很自然地想到,可以取值最大的输出为置信输出.更进一步想到,如果有三个人A.B.C分别 ...

  6. Python 多重继承时metaclass conflict问题解决与原理探究

    背景 最近有一个需求需要自定义一个多继承abc.ABC与django.contrib.admin.ModelAdmin两个父类的抽象子类,方便不同模块复用大部分代码,同时强制必须实现所有抽象方法,没想 ...

  7. 最全iOS 上架指南

    一.上架基本需求资料 1.苹果开发者账号(公司已有可以不用申请,需要开通开发者功能,每年 99 美元) 2.开发好的APP 二.证书 上架版本需要使用正式的证书 1.创建证书 Apple Develo ...

  8. Agda学习笔记1

    目录 Agda学习笔记1 快捷键 refl Natural Number 自然数集合 operations rewrite cong 加法结合律 加法交换律 乘法分配律 比较大小 衍生的一些证明 be ...

  9. Java继承Frame画一个窗口显示图片

    将图片显示到窗口上. 在工程目录下准备好图片5.png 运行代码: import javax.imageio.ImageIO; import java.awt.*; import java.awt.e ...

  10. tool1

    //导出 public void excel(List<Long> ids, HttpServletResponse response) { List<StockPageVo> ...