django.db.migrations.exceptions.NodeNotFoundError: Migration users.0001_initial dependencies reference nonexistent parent node ('auth', '0009_auto_20200720_0228')

问题:

(meiduo) D:\python_learn\meiduo_project\meiduo_mall>python manage.py makemigrations
[<RegexURLPattern admins-list ^permission/admins/$>, <RegexURLPattern admins-list ^permission/admins\.(?P<format>[a-z0-9]+)/?$>, <RegexURLPattern admins-detail ^permission/admins/(?P<pk
>[^/.]+)/$>, <RegexURLPattern admins-detail ^permission/admins/(?P<pk>[^/.]+)\.(?P<format>[a-z0-9]+)/?$>, <RegexURLPattern api-root ^$>, <RegexURLPattern api-root ^\.(?P<format>[a-z0-9]
+)/?$>]
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "C:\ProgramData\anaconda3\envs\meiduo\lib\site-packages\django\core\management\__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "C:\ProgramData\anaconda3\envs\meiduo\lib\site-packages\django\core\management\__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\ProgramData\anaconda3\envs\meiduo\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\ProgramData\anaconda3\envs\meiduo\lib\site-packages\django\core\management\base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "C:\ProgramData\anaconda3\envs\meiduo\lib\site-packages\django\core\management\commands\makemigrations.py", line 96, in handle
    loader = MigrationLoader(None, ignore_no_migrations=True)
  File "C:\ProgramData\anaconda3\envs\meiduo\lib\site-packages\django\db\migrations\loader.py", line 52, in __init__
    self.build_graph()
  File "C:\ProgramData\anaconda3\envs\meiduo\lib\site-packages\django\db\migrations\loader.py", line 274, in build_graph
    raise exc
  File "C:\ProgramData\anaconda3\envs\meiduo\lib\site-packages\django\db\migrations\loader.py", line 244, in build_graph
    self.graph.validate_consistency()
  File "C:\ProgramData\anaconda3\envs\meiduo\lib\site-packages\django\db\migrations\graph.py", line 261, in validate_consistency
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "C:\ProgramData\anaconda3\envs\meiduo\lib\site-packages\django\db\migrations\graph.py", line 261, in <listcomp>
    [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
  File "C:\ProgramData\anaconda3\envs\meiduo\lib\site-packages\django\db\migrations\graph.py", line 104, in raise_error
    raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration users.0001_initial dependencies reference nonexistent parent node ('auth', '0009_auto_20200720_0228')

出现问题原因是之前用的python环境是3.8,但是在使用celery过程中一直报错,网上查阅发现了,celery对windows环境的支持情况和在windows下运行的python版本有关系,所以换了python 3.6版本;

然后发现换了之后出现了上述问题;

解决方法是:

找到之前使用的虚拟环境中的  '0009_auto_20200720_0228'  文件和对应的缓存文件

 

 

 

 拷贝到现在虚拟环境的对应目录下;再次运行没有报错消失

 

posted @ 2020-08-16 20:51  sewen  Views(2273)  Comments(0Edit  收藏  举报