到目前爲止,我已經嘗試過任何關於這個問題的因特網給我,我仍然沒有解決它。在django中無法擺脫「不存在的父節點」1.11
的Python 3.6.1 - Django的1.11.2 - 的virtualenv
我有兩個應用程序account
和app2
一個Django項目。最近我決定隨着項目的增長將它們分成更合適的應用程序。現在我總共有8個應用程序,其中account
分爲user_auth
和user
,然後我刪除account
。爲了整理它,我將所有應用程序從根文件夾移動到/apps/
。
到目前爲止,只有user, user_auth, app2
正在使用,其中app2
未被觸及。
將每個單獨文件中的代碼拆分,移動到指定的應用程序並重新編碼以從正確的路徑導入。
要獲得一個全新的開始我刪除db.sqlite3文件,刪除所有*.pyc
文件,刪除所有__pycache__
文件夾,並清空了migrations
文件夾,確保把所有__init__.py
文件。
通過的virtualenv運行python manage.py migrate
給了我這樣的輸出:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "H:\Programming\VirProjDir\lib\site-packages\django\core\management\__init__.py", line 363, in execute_from_command_line
utility.execute()
File "H:\Programming\VirProjDir\lib\site-packages\django\core\management\__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "H:\Programming\VirProjDir\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "H:\Programming\VirProjDir\lib\site-packages\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "H:\Programming\VirProjDir\lib\site-packages\django\core\management\commands\migrate.py", line 83, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "H:\Programming\VirProjDir\lib\site-packages\django\db\migrations\executor.py", line 20, in __init__
self.loader = MigrationLoader(self.connection)
File "H:\Programming\VirProjDir\lib\site-packages\django\db\migrations\loader.py", line 52, in __init__
self.build_graph()
File "H:\Programming\VirProjDir\lib\site-packages\django\db\migrations\loader.py", line 274, in build_graph
raise exc
File "H:\Programming\VirProjDir\lib\site-packages\django\db\migrations\loader.py", line 244, in build_graph
self.graph.validate_consistency()
File "H:\Programming\VirProjDir\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 "H:\Programming\VirProjDir\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 "H:\Programming\VirProjDir\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 auth.0009_user_following dependencies reference nonexistent parent node ('account', '0002_contact')
到目前爲止,我已經受夠了這些命令沒有運氣,確保消除所有緩存和* pyc文件其間:
python manage.py migrate
python manage.py makemigrations
python manage.py makemigrations <app_name>
python manage.py flush
python manage.py --fake
python manage.py --fake <app_name> zero
etc..
我不明白爲什麼('account', '0002_contact')
不斷顯示即使我刪除了與我的代碼沒有直接關係的任何東西。
「包含文本」 - 搜索沒有顯示account
。
任何想法在哪裏看下?
我建議閱讀以下兩篇文章:[post1](https:// stackoverflow。com/questions/31281377/django-nodenotfounderror-migration-migration)[post2](https://stackoverflow.com/questions/37937343/django-db-migrations-exceptions-nodenotfounderror) – pooya