简体   繁体   English

我的项目中没有名为“帐户”的应用程序,但 django 仍然抛出 django.db.migrations.exceptions.NodeNotFoundError

[英]No app named 'account' in my project but django still throws django.db.migrations.exceptions.NodeNotFoundError

Traceback:追溯:

File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "D:\Anaconda\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "D:\Anaconda\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "D:\Anaconda\lib\site-packages\django\core\management\base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "D:\Anaconda\lib\site-packages\django\core\management\base.py", line 369, in execute
    output = self.handle(*args, **options)
  File "D:\Anaconda\lib\site-packages\django\core\management\base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "D:\Anaconda\lib\site-packages\django\core\management\commands\makemigrations.py", line 87, in handle
    loader = MigrationLoader(None, ignore_no_migrations=True)
  File "D:\Anaconda\lib\site-packages\django\db\migrations\loader.py", line 49, in __init__
    self.build_graph()
  File "D:\Anaconda\lib\site-packages\django\db\migrations\loader.py", line 274, in build_graph
    raise exc
  File "D:\Anaconda\lib\site-packages\django\db\migrations\loader.py", line 248, in build_graph
    self.graph.validate_consistency()
  File "D:\Anaconda\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 "D:\Anaconda\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 "D:\Anaconda\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.0012_user_following dependencies reference nonexistent parent node ('account', '0002_contact')

pip freeze txt file link: pip 冻结txt文件链接:

https://github.com/shyamparmar29/pip-freeze/blob/master/freeze.docx https://github.com/shymparmar29/pip-freeze/blob/master/freeze.docx

There's no app named account in my project but i am still getting this error.我的项目中没有名为 account 的应用程序,但我仍然收到此错误。 I have tried to delete all pycache and migration files but it is not helping.我试图删除所有 pycache 和迁移文件,但它没有帮助。

I even tried to run the project in a virtual environment but i am still getting this error.我什至尝试在虚拟环境中运行该项目,但仍然出现此错误。

Please help.请帮忙。

do these steps:执行以下步骤:

1- delete migrations folder in each app 1-删除每个应用程序中的迁移文件夹

2- delete database tables or simply delete it completely 2-删除数据库表或完全删除它

3- run./manage.py makemigrations appname for each app 3- run./manage.py makemigrations appname 为每个应用程序

4- run./manage.py migrate 4-运行./manage.py 迁移

5- finally run the server and see what happens 5-最后运行服务器,看看会发生什么

if it does not work again see this .如果它不工作再次看到这个

edit: delete your DB and run编辑:删除您的数据库并运行

python manage.py migrate --fake auth zero python manage.py migrate --fake auth zero

then make migrations again.然后再次进行迁移。

You can try the following specific operations as follows:可以尝试如下具体操作:

  1. Delete through the query path under the local python3.8 file:通过本地python3.8文件下的查询路径删除:

    https://i.stack.imgur.com/FMe2r.png ( reference ) https://i.stack.imgur.com/FMe2r.png (参考)

  2. Delete the migration file that is determined to be wrong, here is the last file starting with 0012.删除确定错误的迁移文件,这里是最后一个0012开头的文件。

  3. Re-execute python3 manage.py makemigrations after deleting删除后重新执行python3 manage.py makemigrations

  4. Execute python3 manage.py migrate执行 python3 manage.py 迁移

At this point, the migration operation should be normal.此时,迁移操作应该是正常的。

Note: You can also search and delete through the library under the pycharm project, the path is the same as above.注意:也可以通过pycharm项目下的库搜索删除,路径同上。 It is easy to find and operate.很容易找到和操作。

暂无
暂无

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

相关问题 django.db.migrations.exceptions.NodeNotFoundError - django.db.migrations.exceptions.NodeNotFoundError Django 迁移 - django.db.migrations.exceptions.NodeNotFoundError - Django migrations - django.db.migrations.exceptions.NodeNotFoundError 删除迁移文件并获取 django.db.migrations.exceptions.NodeNotFoundError: - Deleting Migration Files and Getting django.db.migrations.exceptions.NodeNotFoundError: 自定义 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 - After deleting my database and trying to apply a new migrations i get this errors that say 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.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压缩了迁移:NodeNotFoundError - Django squashed migrations: NodeNotFoundError
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM