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',)
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