简体   繁体   English

删除我的数据库并尝试应用新的迁移后,我收到了这个错误,说 django.db.migrations.exceptions.NodeNotFoundError

[英]After deleting my database and trying to apply a new migrations i get this errors that say django.db.migrations.exceptions.NodeNotFoundError

Am trying to apply a migration to a new database but I keep getting this error, I have deleted all migration files in my old database and also files in the apps.我正在尝试将迁移应用到新数据库,但我不断收到此错误,我已删除旧数据库中的所有迁移文件以及应用程序中的文件。 when I tried applying migrations to a new database or running python manage.py runserver then I get this error..?当我尝试将迁移应用到新数据库或运行 python manage.py runserver 时,我收到此错误..? I wonder what might be the problem.我想知道可能是什么问题。 am using Django 3.1.1我正在使用 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')

Well!好! I was finally able to fix this problem by first uninstalling Django on my virtual env and then redo the installation, but the problem had still persisted, so I just followed my intuition by deleting the whole virtual env, I did the installation of virtualenv and then installed Django and it worked, perfectly.我终于能够通过首先在我的虚拟环境上卸载 Django 然后重新安装来解决这个问题,但问题仍然存在,所以我只是按照我的直觉删除了整个虚拟环境,我安装了 virtualenv 然后安装了 Django,它完美地工作。 Thank you to all who had tried to help, I really appreciated your answers.感谢所有试图提供帮助的人,我非常感谢您的回答。

The auth.0013_user_following migration requires the 0003_contact migration which is missing. auth.0013_user_following 迁移需要缺少 0003_contact 迁移。

Try removing all migrations from all apps and set a new database.尝试从所有应用程序中删除所有迁移并设置新数据库。

Based on the solution provided by Abubakari UmarblacKrussain Uma, I noticed that packages linked to my virtual environment file were missing/corrupted.根据 Abubakari UmarblacKrussain Uma 提供的解决方案,我注意到链接到我的虚拟环境文件的包丢失/损坏。 When I checked it against my requirements.text file, I noticed that the Django package was replaced by django 2.2.27 (django lowercase), and an entry -jango 3.1.3 was added.当我根据我的requirements.text文件检查它时,我注意到Django包被django 2.2.27(django小写)替换,并添加了一个条目-jango 3.1.3。 I manually edited the requirements.txt file to remove the -jango 3.1.3 entry and replace the django 2.2.27 with Django 3.1.3 and reloaded the virtual environment from requirements.txt .我手动编辑了requirements.txt文件以删除 -jango 3.1.3 条目并将 django 2.2.27 替换为 Django 3.1.3 并从requirements.txt重新加载虚拟环境。 This resolved the error.这解决了错误。 For good measure I re-generated the requirements.txt file for the virtual environment.为了更好的衡量,我为虚拟环境重新生成了requirements.txt文件。

暂无
暂无

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

相关问题 删除迁移文件并获取 django.db.migrations.exceptions.NodeNotFoundError: - Deleting Migration Files and Getting django.db.migrations.exceptions.NodeNotFoundError: django.db.migrations.exceptions.NodeNotFoundError - django.db.migrations.exceptions.NodeNotFoundError Django 迁移 - django.db.migrations.exceptions.NodeNotFoundError - Django migrations - django.db.migrations.exceptions.NodeNotFoundError 我的项目中没有名为“帐户”的应用程序,但 django 仍然抛出 django.db.migrations.exceptions.NodeNotFoundError - No app named 'account' in my project but django still throws django.db.migrations.exceptions.NodeNotFoundError django.db.migrations.exceptions.NodeNotFoundError:运行“python manage.py migrate”时 - django.db.migrations.exceptions.NodeNotFoundError: upon running "python manage.py migrate" django.db.migrations.exceptions.NodeNotFoundError:迁移accounts.0001_initial依赖项引用不存在的父节点 - django.db.migrations.exceptions.NodeNotFoundError: Migration accounts.0001_initial dependencies reference nonexistent parent node 在命令提示符下运行服务器时出现 django.db.migrations.exceptions.NodeNotFoundError - django.db.migrations.exceptions.NodeNotFoundError when running the server in command prompt 自定义 django 数据迁移创建记录 allauth.account EmailAddress model 返回错误 - django.db.migrations.exceptions.NodeNotFoundError: - Custom django data migration creating records allauth.account EmailAddress model returns error - django.db.migrations.exceptions.NodeNotFoundError: django.db.migrations.exceptions.NodeNotFoundError:迁移 app.0172_auto_20220603_1746 依赖 _auto_20220601_2313&#39;) - django.db.migrations.exceptions.NodeNotFoundError: Migration app.0172_auto_20220603_1746 dependencie _auto_20220601_2313') Django压缩了迁移:NodeNotFoundError - Django squashed migrations: NodeNotFoundError
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM