Skip to main content

A toolbox of small utilities to assist Django development

Project description

Introduction

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 jQuery debug() function.

Installation

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 .

Configuration

Add the module to the installed apps:

INSTALLED_APPS += (
    'debugtools',
)

Features

X-View Middleware

Add the following setting:

INTERNAL_IPS = (
    '127.0.0.1',
)

MIDDLEWARE_CLASSES += (
    'debugtools.middleware.XViewMiddleware',
)

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:

https://github.com/edoburu/django-debugtools/raw/master/docs/images/firebug-xview.png

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

jQuery debug print

Add the following to the page:

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

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

$("#foo").children('li').debug().addClass('bar');

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-debugtools-1.2.1.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

django_debugtools-1.2.1-py2.py3-none-any.whl (14.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-debugtools-1.2.1.tar.gz.

File metadata

File hashes

Hashes for django-debugtools-1.2.1.tar.gz
Algorithm Hash digest
SHA256 82f9020988591365d8223e40fe180ca017007879648d942049ef3226802af84b
MD5 6c54e83fa3fc6f0834b169d3b4f906b2
BLAKE2b-256 b6196c19befa3f78d61c7a37bc6351cbf92c6ab7bb69c8d40da99082d4f342e9

See more details on using hashes here.

File details

Details for the file django_debugtools-1.2.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_debugtools-1.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cb093d7582b11a9806901c98226c405d5af9458e8168f34f67cb78f8ea2395b5
MD5 9ccecc351489e22203b96efae8186fca
BLAKE2b-256 59e0e66bb86a100d4a95f4ee2213162ea7bd1d7e108757be1d9ea29c760f529a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page