django.db.migrations.exceptions.NodeNotFoundError: Migration users.0001_initial dependencies reference nonexistent parent node ('auth', '0009_auto_20200720_0228')
阿新 • • 發佈:2020-08-16
問題:
(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' 檔案和對應的快取檔案
拷貝到現在虛擬環境的對應目錄下;再次執行沒有報錯消失