当前位置:  开发笔记 > 编程语言 > 正文

Django 1.8到1.9升级:django.core.exceptions.AppRegistryNotReady:尚未加载应用程序

如何解决《Django1.8到1.9升级:django.core.exceptions.AppRegistryNotReady:尚未加载应用程序》经验,为你挑选了1个好方法。

我有一个目前正在研究Django 1.8的项目.自从1.9刚刚发布以来,我想我会通过更新pip install django==1.9.但是,在运行时python manage.py test -v 3,我收到此错误:

Traceback (most recent call last):
  File "manage.py", line 11, in 
    execute_from_command_line(sys.argv)
  File "/home/user/Envs/intranet/lib/python2.7/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
    utility.execute()
  File "/home/user/Envs/intranet/lib/python2.7/site-packages/django/core/management/__init__.py", line 324, in execute
    django.setup()
  File "/home/user/Envs/intranet/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/user/Envs/intranet/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/user/Envs/intranet/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/user/Envs/intranet/lib/python2.7/site-packages/reversion/__init__.py", line 11, in 
    from reversion.revisions import default_revision_manager, revision_context_manager, VersionAdapter
  File "/home/user/Envs/intranet/lib/python2.7/site-packages/reversion/revisions.py", line 18, in 
    from django.contrib.contenttypes.models import ContentType
  File "/home/user/Envs/intranet/lib/python2.7/site-packages/django/contrib/contenttypes/models.py", line 159, in 
    class ContentType(models.Model):
  File "/home/user/Envs/intranet/lib/python2.7/site-packages/django/db/models/base.py", line 94, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/home/user/Envs/intranet/lib/python2.7/site-packages/django/apps/registry.py", line 239, in get_containing_app_config
    self.check_apps_ready()
  File "/home/user/Envs/intranet/lib/python2.7/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.

我知道INSTALLED_APPS从一个元组变为一个列表.

还有什么我可能错过的?



1> ndpu..:

尝试升级django-reversion,今天发布了1.10版本:

Django 1.9兼容性(@etianen).

来自讨论组的消息https://groups.google.com/forum/#!topic/django-reversion/3AQipnbKaUI

最新版本的django-reversion(1.10.0)现在可以在GitHub和PyPi上使用.此版本增加了与Django 1.9的兼容性.

重要提示:此版本包含重大更改.请在安装之前查看GitHub上的发行说明.

遗憾的是,为了支持Django 1.9,需要进行这些重大更改.令人高兴的是,您需要做的就是修改您的返回导入位置,一切都将继续有效.

快乐的编码!

推荐阅读
TXCWB_523
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有