Django 从更新到 1.9 后提高 AppRegistryNotReady

Django raising AppRegistryNotReady after update from to 1.9

我读过许多类似的 post 具有相同情况的文章,并尝试了一些建议,如果它们完全相关的话。我刚刚更新到 Django 1.9,我收到了这个回溯:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/django/www/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
    utility.execute()
  File "/opt/django/www/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 302, in execute
    settings.INSTALLED_APPS
  File "/opt/django/www/local/lib/python2.7/site-packages/django/conf/__init__.py", line 55, in __getattr__
    self._setup(name)
  File "/opt/django/www/local/lib/python2.7/site-packages/django/conf/__init__.py", line 43, in _setup
    self._wrapped = Settings(settings_module)
  File "/opt/django/www/local/lib/python2.7/site-packages/django/conf/__init__.py", line 99, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/django/www/src/site_aggrigator/__init__.py", line 2, in <module>
    import management
  File "/opt/django/www/src/site_aggrigator/management/__init__.py", line 4, in <module>
    from django.contrib.auth.models import Permission
  File "/opt/django/www/local/lib/python2.7/site-packages/django/contrib/auth/models.py", line 4, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/opt/django/www/local/lib/python2.7/site-packages/django/contrib/auth/base_user.py", line 49, in <module>
    class AbstractBaseUser(models.Model):
  File "/opt/django/www/local/lib/python2.7/site-packages/django/db/models/base.py", line 94, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/opt/django/www/local/lib/python2.7/site-packages/django/apps/registry.py", line 239, in get_containing_app_config
    self.check_apps_ready()
  File "/opt/django/www/local/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.

我所有的应用程序肯定都安装在我的虚拟环境中,因为在我进行更新之前应用程序 运行 没问题。我在更新之前也收到了这个:

/opt/django/www/local/lib/python2.7/site-packages/Django-1.8-py2.7.egg/django/contrib/auth/models.py:41: RemovedInDjango19Warning: Model class django.contrib.auth.models.Permission doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9.
  class Permission(models.Model):

还有一个 post 提供了以下解决方案: INSTALLED_APPS = ( "django.contrib.auth.models.Permission",

我也按照他们所说的那样做了,这将是一个可行的解决方案。还有其他人遇到过这个问题吗?

尝试添加这个(在SECRET_KEY声明之后):

import django
django.setup()