gpt4 book ai didi

python - Django AppRegistryNotReady 错误

转载 作者:太空宇宙 更新时间:2023-11-03 17:18:31 27 4
gpt4 key购买 nike

将我的项目从 1.8.5 迁移到 1.9b1 会导致下一次回溯

Traceback (most recent call last):
File "/Users/.../manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/.../env3/lib/python3.5/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/Users/.../env3/lib/python3.5/site-packages/django/core/management/__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/.../env3/lib/python3.5/site-packages/django/core/management/__init__.py", line 176, in fetch_command
commands = get_commands()
File "/Users/.../env3/lib/python3.5/site-packages/django/core/management/__init__.py", line 71, in get_commands
for app_config in reversed(list(apps.get_app_configs())):
File "/Users/.../env3/lib/python3.5/site-packages/django/apps/registry.py", line 137, in get_app_configs
self.check_apps_ready()
File "/Users/.../env3/lib/python3.5/site-packages/django/apps/registry.py", line 124, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

Process finished with exit code 1

我的manage.py很简单:

#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.base")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)

我检查了 Django 1.9 更新指南,但它没有提供有关应用程序加载的任何信息。

最佳答案

当找不到设置文件时,我通常会看到类似的错误消息堆栈。因此,在这种情况下,您的 settings\base.py 文件要么无法找到,要么缺少 django 1.9 所需的一些设置。

由于这是一次迁移,我假设您正在使用 virtualenv,并且已将 django 1.9b1 pip 安装到新环境中并在那里运行应用程序。

如果是这种情况,请尝试创建一个新的“虚拟”项目来查看干净的 django 1.9 设置文件是什么样子。

关于python - Django AppRegistryNotReady 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33414210/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com