Python 删除数据库并尝试应用新的迁移后,我会收到以下错误,即django.db.migrations.exceptions.NodeNotFoundError

Python 删除数据库并尝试应用新的迁移后,我会收到以下错误,即django.db.migrations.exceptions.NodeNotFoundError,python,python-3.x,django,django-models,django-rest-framework,Python,Python 3.x,Django,Django Models,Django Rest Framework,我正在尝试将迁移应用到新数据库,但我不断收到此错误,我已删除旧数据库中的所有迁移文件以及应用程序中的文件。当我尝试将迁移应用到新数据库或运行python manage.py runserver时,出现了以下错误。。?我想知道可能是什么问题。am使用Django 3.1.1 E:\All django project\Real-Estate-Django-Web-App-master>manage.py migrate Traceback (most recent call last):

我正在尝试将迁移应用到新数据库,但我不断收到此错误,我已删除旧数据库中的所有迁移文件以及应用程序中的文件。当我尝试将迁移应用到新数据库或运行python manage.py runserver时,出现了以下错误。。?我想知道可能是什么问题。am使用Django 3.1.1

E:\All django project\Real-Estate-Django-Web-App-master>manage.py migrate
Traceback (most recent call last):
  File "E:\All django project\Real-Estate-Django-Web-App-master\manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Python38\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:\Python38\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python38\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Python38\lib\site-packages\django\core\management\base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "C:\Python38\lib\site-packages\django\core\management\base.py", line 85, in wrapped
    res = handle_func(*args, **kwargs)
  File "C:\Python38\lib\site-packages\django\core\management\commands\migrate.py", line 92, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "C:\Python38\lib\site-packages\django\db\migrations\executor.py", line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File "C:\Python38\lib\site-packages\django\db\migrations\loader.py", line 53, in __init__
    self.build_graph()
  File "C:\Python38\lib\site-packages\django\db\migrations\loader.py", line 255, in build_graph
    self.graph.validate_consistency()
  File "C:\Python38\lib\site-packages\django\db\migrations\graph.py", line 195, in validate_consistency
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "C:\Python38\lib\site-packages\django\db\migrations\graph.py", line 195, in <listcomp>
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "C:\Python38\lib\site-packages\django\db\migrations\graph.py", line 58, in raise_error
    raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration auth.0013_user_following dependencies reference nonexistent parent node ('account', '0003_contact')

E:\All django project\Real Estate django Web App master>manage.py迁移
回溯(最近一次呼叫最后一次):
文件“E:\All django project\Real Estate django Web App master\manage.py”,第15行,在
从命令行(sys.argv)执行命令
文件“C:\Python38\lib\site packages\django\core\management\\uuuuu init\uuuuuuu.py”,第401行,从命令行执行
utility.execute()
文件“C:\Python38\lib\site packages\django\core\management\\uuuu init\uuuuu.py”,第395行,在execute中
self.fetch_命令(子命令)。从_argv(self.argv)运行_
文件“C:\Python38\lib\site packages\django\core\management\base.py”,第330行,从\u argv运行\u
self.execute(*args,**cmd_选项)
文件“C:\Python38\lib\site packages\django\core\management\base.py”,第371行,在execute中
输出=self.handle(*args,**选项)
文件“C:\Python38\lib\site packages\django\core\management\base.py”,第85行,已包装
res=句柄函数(*args,**kwargs)
文件“C:\Python38\lib\site packages\django\core\management\commands\migrate.py”,第92行,在句柄中
executor=MigrationExecutor(连接、self.migration\u进程\u回调)
文件“C:\Python38\lib\site packages\django\db\migrations\executor.py”,第18行,在\uuu init中__
self.loader=MigrationLoader(self.connection)
文件“C:\Python38\lib\site packages\django\db\migrations\loader.py”,第53行,在\uu init中__
self.build_图()
文件“C:\Python38\lib\site packages\django\db\migrations\loader.py”,第255行,在构建图中
self.graph.validate_一致性()
文件“C:\Python38\lib\site packages\django\db\migrations\graph.py”,第195行,验证一致性
[n.在self.node_map.values()中为n增加_error(),如果是instance(n,DummyNode)]
文件“C:\Python38\lib\site packages\django\db\migrations\graph.py”,第195行,在
[n.在self.node_map.values()中为n增加_error(),如果是instance(n,DummyNode)]
文件“C:\Python38\lib\site packages\django\db\migrations\graph.py”,第58行,出现错误
raise NodeNotFoundError(self.error\u消息,self.key,origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError:Migration auth.0013\u user\u以下依赖项引用不存在的父节点(“帐户”、“0003\u联系人”)

迁移后的auth.0013\u用户需要缺少的0003\u联系人迁移


尝试从所有应用中删除所有迁移并设置新数据库。

好!我终于能够解决这个问题,首先在我的虚拟环境上卸载Django,然后重新安装,但问题仍然存在,所以我只是按照我的直觉删除了整个虚拟环境,我安装了virtualenv,然后安装了Django,效果非常好。感谢所有试图提供帮助的人,我非常感谢您的回答。

基于Abubakari UmarblacKrussain Uma提供的解决方案,我注意到链接到我的虚拟环境文件的包丢失/损坏。当我对照我的requirements.text文件检查它时,我注意到Django包被Django 2.2.27(Django小写)替换,并添加了一个条目-jango 3.1.3。我手动编辑了requirements.txt文件,以删除-jango 3.1.3条目,并用django 3.1.3替换django 2.2.27,然后从requirements.txt重新加载虚拟环境。这解决了错误。为了更好地衡量,我为虚拟环境重新生成了requirements.txt文件。

auth应用程序中的迁移文件
0013\u user\u后面的
引用了一个不存在的
0003\u联系人
迁移。您可能删除了错误的迁移文件。我已签入所有应用程序文件,并确保所有已删除的迁移(包括pyc文件)仍然无法定位此问题是否存在。我尝试在settings.py中对auth应用程序进行注释,但随后它引发了一个运行时错误。除此之外,我还遇到了相同的错误…项目中我的应用程序中的所有迁移文件都已删除。请删除数据库并创建一个新的数据库。下面是一篇关于如何重置数据库的文章:我就是这么做的,但仍然是一样的。