移动到生产服务器后Django迁移不存在的父节点
Django migration non existent parent node after moving to production server
我正在尝试在 PythonAnywhere 上部署我的应用程序,当我去应用迁移时,我收到一个错误,指出迁移依赖项不存在。
我已通过从迁移文件夹中删除它们、删除数据库并重新创建它以及 运行ning makemigrations 来完全重置迁移。
我现在只有一个初始迁移,一切都在我的本地机器上运行。
工作流程是这样的:
1 - 将我正在使用的当前版本克隆到 PythonAnywhere。
2 - 运行 ./manage migrate 初始化数据库(第一次)并得到错误:
(rwe) 17:00 ~/rwe (develop)$ ./manage.py migrate
asyncio DEBUG Using selector: EpollSelector
Traceback (most recent call last):
File "./manage.py", line 21, in <module>
main()
File "./manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 86, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/db/migrations/executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/db/migrations/loader.py", line 49, in __init__
self.build_graph()
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/db/migrations/loader.py", line 274, in build_graph
raise exc
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/db/migrations/loader.py", line 248, in build_graph
self.graph.validate_consistency()
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/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 "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/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 "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/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 backend.0001_initial dependencies reference nonexistent parent node ('auth', '0013_delete_users')
(rwe) 17:12 ~/rwe (develop)$
网站加载,我可以浏览等等。考虑到初始迁移尚未应用,我无法使用任何依赖于数据库的东西。
系统之间唯一真正的变化是生产和 DEBUG=False 的密钥不同
我明白了。
我将 django 从 2.2.3 更新到 3.0.3,我缺少的迁移一定是在我使用 2.2.3 期间生成的。
适用于我,但不适用于我的 PythonAnywhere 服务器。我在我的开发机器上重新创建了我的 virtualenv 并重置了我所有的迁移。现在一切都匹配没有问题。
我正在尝试在 PythonAnywhere 上部署我的应用程序,当我去应用迁移时,我收到一个错误,指出迁移依赖项不存在。
我已通过从迁移文件夹中删除它们、删除数据库并重新创建它以及 运行ning makemigrations 来完全重置迁移。
我现在只有一个初始迁移,一切都在我的本地机器上运行。
工作流程是这样的:
1 - 将我正在使用的当前版本克隆到 PythonAnywhere。 2 - 运行 ./manage migrate 初始化数据库(第一次)并得到错误:
(rwe) 17:00 ~/rwe (develop)$ ./manage.py migrate
asyncio DEBUG Using selector: EpollSelector
Traceback (most recent call last):
File "./manage.py", line 21, in <module>
main()
File "./manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 86, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/db/migrations/executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/db/migrations/loader.py", line 49, in __init__
self.build_graph()
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/db/migrations/loader.py", line 274, in build_graph
raise exc
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/site-packages/django/db/migrations/loader.py", line 248, in build_graph
self.graph.validate_consistency()
File "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/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 "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/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 "/home/IAMCB/.virtualenvs/rwe-Cn2YEGYr/lib/python3.7/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 backend.0001_initial dependencies reference nonexistent parent node ('auth', '0013_delete_users')
(rwe) 17:12 ~/rwe (develop)$
网站加载,我可以浏览等等。考虑到初始迁移尚未应用,我无法使用任何依赖于数据库的东西。
系统之间唯一真正的变化是生产和 DEBUG=False 的密钥不同
我明白了。
我将 django 从 2.2.3 更新到 3.0.3,我缺少的迁移一定是在我使用 2.2.3 期间生成的。
适用于我,但不适用于我的 PythonAnywhere 服务器。我在我的开发机器上重新创建了我的 virtualenv 并重置了我所有的迁移。现在一切都匹配没有问题。