skip to navigation
skip to content

django-debugtools 1.7.3

A toolbox of small utilities to assist Django development


The debugtools module offers some easy to use debugging utilities to assist Django development. It features:

  • A template tag to print context.
  • A XViewMiddleware variation to see which view and template was used to render a page.
  • A panel for django-debug-toolbar to show which view and template was used to render a page.
  • A jQuery debug() function.


First install the module, preferably in a virtual environment. It can be installed from PyPI:

pip install django-debugtools

Or the current folder can be installed:

pip install .


Add the module to the installed apps:


As of Django 1.9, either use {% load debugtools_tags %} or add the following to the settings:

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                # ...
           'builtins': [                                     # Add this section
                "debugtools.templatetags.debugtools_tags",   # Add this line

Or, when you use a settings file:

TEMPLATES[0]['OPTIONS']['builtins'] += [
    "debugtools.templatetags.debugtools_tags",  # enables {% print %}


Debug Toolbar Panel

Add the following settings to your django-debug-toolbar configuration:

    'debugtools.panels.ViewPanel',    # Add this one

jQuery debug print

Add the following to the page:

<script type="text/javascript" src="{{ STATIC_URL }}debugtools/jquery.debug.js"></script>

Now you can print the jQuery selector context to the console:


This will print the matched <li> elements in the console, among with the current jQuery selector. Optionally, a prefix can be included in the debug() call:

$("#foo").debug("at baz: ").addClass('bar');

X-View Middleware

As alternative to the django-debug-toolbar panel, you can also add the XViewMiddleware. Add the following setting:



All requests from the internal IP, or made by the admin user will have a X-View header and X-View-Template header. In the Firebug console, or Chrome web inspector, you can see which view and template handled the current request:

The alternative templates are also displayed, in case the view allows the template to be overwritten with a different name.

File Type Py Version Uploaded on Size
django-debugtools-1.7.3.tar.gz (md5) Source 2018-02-13 20KB
django_debugtools-1.7.3-py2.py3-none-any.whl (md5) Python Wheel py2.py3 2018-02-13 20KB