0

i have PIP INSTALL DJANGO-DEBUG-TOOLBAR for django 1.9,and here is the error message when i PYTHON MANAGE.PY RUNSERVER:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 350, in execute_from_command_line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 342, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 176, in fetch_command
    commands = get_commands()
  File "C:\Python27\lib\site-packages\django\utils\lru_cache.py", line 100, in wrapper
    result = user_function(*args, **kwds)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 71, in get_commands
    for app_config in reversed(list(apps.get_app_configs())):
  File "C:\Python27\lib\site-packages\django\apps\registry.py", line 137, in get_app_configs
    self.check_apps_ready()
  File "C:\Python27\lib\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.

What i have done is as follows:

1,pip install django-debug-toolbar;

2,add debug_toolbar to INSTALLED_APPS;

3,add 'debug_toolbar.middleware.DebugToolbarMiddleware' to 'MIDDLEWARE_CLASSES ';

4,put 'DEBUG_TOOLBAR_PANELS ' into setting.py file;

5,set DEGUG=True ,and set DEBUG_TOOLBAR_PATCH_SETTINGS = False;

6,as the official document says,put

if settings.DEBUG:
    import debug_toolbar
    urlpatterns += patterns('',
        url(r'^__debug__/', include(debug_toolbar.urls)),
    )

into urls.py

7,and all i have done on WINDOWS 10 os, as my test.

Someone can figure out my wrong steps? thanks a lot.

2 Answers2

1

Please try pip freeze and check that django-debug-toolbar is installed properly. In Windows you should install pypi packages in CMD as Administrator or in virtualenv. Otherwise Windows won't let you to install package by pip.

PatNowak
  • 5,721
  • 1
  • 25
  • 31
0

Also had issues installing django-debug-toolbar for Django 1.9.8:
These are the steps that helped me:

1.pip install django-debug-toolbar;
2. This is my dev.py ( delelopments settings):

"""Development settings and globals."""
from .base import *

# DEBUG CONFIGURATION
DEBUG = True

MIDDLEWARE_CLASSES += ['debug_toolbar.middleware.DebugToolbarMiddleware', ]
INSTALLED_APPS += ['debug_toolbar', ]

INTERNAL_IPS = ['127.0.0.1', '10.0.2.2', ]

DEBUG_TOOLBAR_CONFIG = {
    'DISABLE_PANELS': [
        'debug_toolbar.panels.redirects.RedirectsPanel',
    ],
    'SHOW_TEMPLATE_CONTEXT': True,
}

3.This is my urls.py

from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin

urlpatterns = [
    url(r'^admin/', admin.site.urls),
]

if settings.DEBUG:
    if 'debug_toolbar' in settings.INSTALLED_APPS:
        import debug_toolbar
        urlpatterns = [
            url(r'^__debug__/', include(debug_toolbar.urls)),
        ] + urlpatterns

4.Also your templates should have enclosing body tag.

Now it should work for Django 1.9.

Yurii Halapup
  • 1,282
  • 19
  • 19