简体   繁体   中英

Django raising AppRegistryNotReady after update from to 1.9

I have read many similar posts with the same situation and tried a few things suggested if they were at all related. I just updated to Django 1.9 and I received this traceback:

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.

All my apps are installed on my virtual env for sure because the app was running fine before I made the update. I also received this right before my update:

/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):

And one post provided a solution of: INSTALLED_APPS = ( "django.contrib.auth.models.Permission",

Which I also did as they said would be a viable solution. Anyone else had this issue?

Try to add this (after the declaration of SECRET_KEY):

import django
django.setup()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM