Django 1.8 到 1.9 升级:django.core.exceptions.AppRegistryNotReady:应用程序尚未加载
Django 1.8 to 1.9 upgrade: django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet
我有一个项目目前正在使用 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 <module>
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 <module>
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 <module>
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 <module>
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 从元组更改为列表。
还有什么我可能遗漏的吗?
尝试升级 django-reversion,今天发布 1.10 version 有:
Django 1.9 compatibility (@etianen).
来自讨论组的消息https://groups.google.com/forum/#!topic/django-reversion/3AQipnbKaUI
The latest release of django-reversion (1.10.0) is now available on
GitHub and PyPi. This release adds compatibility with Django 1.9.
Important: This release contains breaking changes. Please review the
release notes on GitHub before installing.
These breaking changes were unfortunately required in order to support
Django 1.9. Happily, all you'll need to do is modify your reversion
import locations, and everything will continue to work.
Happy coding!
我有一个项目目前正在使用 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 <module>
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 <module>
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 <module>
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 <module>
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 从元组更改为列表。
还有什么我可能遗漏的吗?
尝试升级 django-reversion,今天发布 1.10 version 有:
Django 1.9 compatibility (@etianen).
来自讨论组的消息https://groups.google.com/forum/#!topic/django-reversion/3AQipnbKaUI
The latest release of django-reversion (1.10.0) is now available on GitHub and PyPi. This release adds compatibility with Django 1.9.
Important: This release contains breaking changes. Please review the release notes on GitHub before installing.
These breaking changes were unfortunately required in order to support Django 1.9. Happily, all you'll need to do is modify your reversion import locations, and everything will continue to work.
Happy coding!