2016-04-28 70 views
0

我已將django版本從1.8升級到1.9,將django rest框架升級到3.3.3。我得到這個異常: django.core.exceptions.AppRegistryNotReady:應用程序尚未加載。異常django.core.exceptions.AppRegistryNotReady:應用程序尚未加載

我試過如下但異常仍然存在。

#__init__.py 
default_app_config = 'panel.apps.PanelConfig' 
所有的應用程序

而且還

#apps.py 
from django.apps import AppConfig 

class PanelConfig(AppConfig): 
    name = 'panel' 

    def ready(self): 
     from panel import receivers 

,並添加這些到安裝的應用程序

'api.apps.ApiConfig', 
'billing.apps.ApiConfig', 
'incoming.apps.IncomingConfig', 
'outgoing.apps.OutgoingConfig', 
'panel.apps.PanelConfig', 

這是我的完整回溯:

Unhandled exception in thread started by <function wrapper at 0x7f3eec09c7d0> 
Traceback (most recent call last): 
    File "/home/sparrow/virtualenvs/bishnu/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper 
    fn(*args, **kwargs) 
    File "/home/sparrow/virtualenvs/bishnu/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run 
    autoreload.raise_last_exception() 
    File "/home/sparrow/virtualenvs/bishnu/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception 
    six.reraise(*_exception) 
    File "/home/sparrow/virtualenvs/bishnu/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper 
    fn(*args, **kwargs) 
    File "/home/sparrow/virtualenvs/bishnu/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup 
    apps.populate(settings.INSTALLED_APPS) 
    File "/home/sparrow/virtualenvs/bishnu/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate 
    app_config = AppConfig.create(entry) 
    File "/home/sparrow/virtualenvs/bishnu/local/lib/python2.7/site-packages/django/apps/config.py", line 90, in create 
    module = import_module(entry) 
    File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module 
    __import__(name) 
    File "/home/sparrow/virtualenvs/bishnu/local/lib/python2.7/site-packages/admin_tools/dashboard/__init__.py", line 1, in <module> 
    from admin_tools.dashboard.dashboards import * 
    File "/home/sparrow/virtualenvs/bishnu/local/lib/python2.7/site-packages/admin_tools/dashboard/dashboards.py", line 13, in <module> 
    from django.contrib.contenttypes.models import ContentType 
    File "/home/sparrow/virtualenvs/bishnu/local/lib/python2.7/site-packages/django/contrib/contenttypes/models.py", line 161, in <module> 
    class ContentType(models.Model): 
    File "/home/sparrow/virtualenvs/bishnu/local/lib/python2.7/site-packages/django/db/models/base.py", line 94, in __new__ 
    app_config = apps.get_containing_app_config(module) 
    File "/home/sparrow/virtualenvs/bishnu/local/lib/python2.7/site-packages/django/apps/registry.py", line 239, in get_containing_app_config 
    self.check_apps_ready() 
    File "/home/sparrow/virtualenvs/bishnu/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. 

例外仍然存在?問題是什麼 ?我沒有得到 ?

+0

完整的回溯可能會顯示導致問題的導入。 – Alasdair

+0

我剛剛搜索了這個錯誤,它提出了幾個StackOverflow頁面,其中有一些人們說爲他們工作的想法。在這裏不會重現它們,但是聽起來像這個錯誤實際上並不是描述根本原因。 – ElPedro

+0

我已經編輯完整的追溯問題,你能幫助嗎? –

回答

0

回溯顯示問題發生在admin_tools

from admin_tools.dashboard.dashboards import * 
    File "/home/sparrow/virtualenvs/bishnu/local/lib/python2.7/site-packages/admin_tools/dashboard/dashboards.py", line 13, in <module> 
    from django.contrib.contenttypes.models import ContentType 

看起來像it has been fixed,所以請嘗試升級到最新版本,目前爲0.7.2。

相關問題