Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django can' t load Module 'debug_toolbar': No module named 'debug_toolbar'

When I try running the project, Django can not load the django-debug-toolbar plugin for some reason. Error message says:

web_1  | ModuleNotFoundError: No module named 'debug_toolbar'

Here is my settings.py

INSTALLED_APPS = [
    # ...
    'django.contrib.staticfiles',
    # ...
    'debug_toolbar',
]

MIDDLEWARE = [
    # ...
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    # ...
]

INTERNAL_IPS = ('127.0.0.1', '192.168.0.1',)
like image 538
Browning M. Avatar asked Feb 04 '19 09:02

Browning M.


2 Answers

if you are not installed the django-debug-toolbar please install with help of below command

pip install django-debug-toolbar
like image 200
vinodsesetti Avatar answered Nov 08 '22 03:11

vinodsesetti


i had to re-install django-debug-toolbar by adding it to requirements.txt and then running:

docker-compose build web

After doing that, the toolbar wasn't still showing. I had to add this code to the settings.py file

def show_toolbar(request):
  return True
DEBUG_TOOLBAR_CONFIG = {
  "SHOW_TOOLBAR_CALLBACK" : show_toolbar,
}

Answered here: https://stackoverflow.com/a/10518040/11011598

like image 3
Browning M. Avatar answered Nov 08 '22 04:11

Browning M.