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 trial

Python Django ORM Same Old ORM django-debug-toolbar

Nursultan Bolatbayev
Nursultan Bolatbayev
16,774 Points

Debug-toolbar doesnt show up on site in local development

Hello. Im using Pycharm for the course.

  1. I have installed debug-toolbar via: pip install django-debug-toolbar
  2. Here is my settings.py file:
DEBUG = True

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'debug_toolbar',
    'journal.apps.JournalConfig',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'debug_toolbar.middleware.DebugToolbarMiddleware',
]

INTERNAL_IPS = ['127.0.0.1',]
  1. Here is my project url.py file:
from django.conf import settings

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

When running it doesnt show any erros except this lines (http 304): "GET /static/debug_toolbar/css/print.css HTTP/1.1" 304 0

1 Answer

In your 'settings.py', add the following line on top of the list in the 'MIDDLEWARE' section:

'debug_toolbar.middleware.DebugToolbarMiddleware'