Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAdam Cameron
Python Web Development Techdegree Graduate 16,731 PointsToolbar only showing up in my local environment when I add Workspaces-specific code?
I followed the django-debug-toolbar installation instructions exactly (they're simple enough, right??) but the toolbar wouldn't show up. I monkeyed around with the positioning of 'debug_toolbar.middleware.DebugToolbarMiddleware'
in MIDDLEWARE_CLASSES
a bunch because the docs suggested there could be an issue there but that didn't solve anything. So on a whim I tried adding the stuff in settings.py that Kenneth says is only if you're on Workspaces, and the toolbar showed up! Any idea why this might be??
1 Answer
Chris Howell
Python Web Development Techdegree Graduate 49,702 PointsAssuming you have done something like (below)
def show_debug_toolbar(request):
return True
# EXAMPLE
# if my settings.py file was located in a 'project_8' folder.
#
DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK': 'project_8.settings.show_debug_toolbar'
}
or Kenneths way
DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK': lambda x: True
}
and it still hasnt worked I would start asking a few other prereq questions such as.
- Is
'debug_toolbar'
in your INSTALLED_APPS - Does your projects
urls.py
contain the following?
# urls.py (project level)
# the urls.py, in same folder as wsgi.py
# make sure this is at the top.
from django.conf import settings
# urlpatterns = [
# keep your other urls here..
# ]
# at the bottom add these lines. under your other urlpatterns.
if settings.DEBUG:
import debug_toolbar
urlpatterns = [
url(r'^__debug__/', include(debug_toolbar.urls)),
]+urlpatterns
Adam Cameron
Python Web Development Techdegree Graduate 16,731 PointsAdam Cameron
Python Web Development Techdegree Graduate 16,731 PointsSo my issue was that the toolbar would show up, but only when I added the Workspaces-specific language (I'm on my local environment). I thought that was weird but it seems the link to the debug toolbar docs links to an older version and I just wasn't noticing that. So my problems were stemming from that. Thank you!