No module named settings_vars error in django debug toolbar

Shiva Krishna Bavandla picture Shiva Krishna Bavandla · Dec 30, 2013 · Viewed 8.7k times · Source

I am trying to use django-degub-toolbar in my django app and below are my settigns

DEBUG_TOOLBAR_PANELS = (
    'debug_toolbar.panels.version.VersionDebugPanel',
    'debug_toolbar.panels.timer.TimerDebugPanel',
    'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
    'debug_toolbar.panels.headers.HeaderDebugPanel',
    'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
    'debug_toolbar.panels.template.TemplateDebugPanel',
    'debug_toolbar.panels.sql.SQLDebugPanel',
    'debug_toolbar.panels.signals.SignalDebugPanel',
    'debug_toolbar.panels.logger.LoggingPanel',
)

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

INSTALLED_APPS += [
 'debug_toolbar',
]

And when i tried to run the server i am getting below error

Validating models...

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x32c8f10>>
Traceback (most recent call last):
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 92, in inner_run
    self.validate(display_num_errors=True)
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/django/core/management/base.py", line 280, in validate
    num_errors = get_validation_errors(s, app)
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/django/core/management/validation.py", line 35, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/django/db/models/loading.py", line 166, in get_app_errors
    self._populate()
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/django/db/models/loading.py", line 72, in _populate
    self.load_app(app_name, True)
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/django/db/models/loading.py", line 96, in load_app
    models = import_module('.models', app_name)
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/user/.virtualenvs/proj/src/django-messages/django_messages/models.py", line 8, in <module>
    User = get_user_model()
  File "/home/user/.virtualenvs/proj/src/django-messages/django_messages/utils.py", line 93, in get_user_model
    return get_user_model()
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 125, in get_user_model
    user_model = get_model(app_label, model_name)
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/django/db/models/loading.py", line 230, in get_model
    self._populate()
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/django/db/models/loading.py", line 72, in _populate
    self.load_app(app_name, True)
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/django/db/models/loading.py", line 96, in load_app
    models = import_module('.models', app_name)
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/debug_toolbar/models.py", line 10, in <module>
    from debug_toolbar.middleware import DebugToolbarMiddleware
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/debug_toolbar/middleware.py", line 13, in <module>
    from debug_toolbar.toolbar import DebugToolbar
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/debug_toolbar/toolbar.py", line 153, in <module>
    urlpatterns = DebugToolbar.get_urls()
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/debug_toolbar/toolbar.py", line 147, in get_urls
    for panel_class in cls.get_panel_classes():
  File "/home/user/.virtualenvs/proj/local/lib/python2.7/site-packages/debug_toolbar/toolbar.py", line 125, in get_panel_classes
    (panel_module, e))
django.core.exceptions.ImproperlyConfigured: Error importing debug panel debug_toolbar.panels.settings_vars: "No module named settings_vars"

How to solve and why the above error has been encountered ?

Answer

Nicolas Cortot picture Nicolas Cortot · Dec 30, 2013

The settings_var panel cannot be found. It seems you use an older version of the configuration. Panels have been renamed recently, the new configuration for version 1.0 is:

DEBUG_TOOLBAR_PANELS = [
    'debug_toolbar.panels.versions.VersionsPanel',
    'debug_toolbar.panels.timer.TimerPanel',
    'debug_toolbar.panels.settings.SettingsPanel',
    'debug_toolbar.panels.headers.HeadersPanel',
    'debug_toolbar.panels.request.RequestPanel',
    'debug_toolbar.panels.sql.SQLPanel',
    'debug_toolbar.panels.staticfiles.StaticFilesPanel',
    'debug_toolbar.panels.templates.TemplatesPanel',
    'debug_toolbar.panels.cache.CachePanel',
    'debug_toolbar.panels.signals.SignalsPanel',
    'debug_toolbar.panels.logging.LoggingPanel',
    'debug_toolbar.panels.redirects.RedirectsPanel',
]