[英]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:可以尝试如下具体操作:
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 (参考)
Delete the migration file that is determined to be wrong, here is the last file starting with 0012.删除确定错误的迁移文件,这里是最后一个0012开头的文件。
Re-execute python3 manage.py makemigrations after deleting删除后重新执行python3 manage.py makemigrations
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.