The Django Debug Toolbar
Rob Hudson's Django Debug Toolbar is a very useful general purpose debugging tool for Django applications. As with the code we developed earlier in this chapter, it lets you see the SQL queries that were needed to produce a page. However, as we will see, it also goes far beyond that, providing easy access to much more information about the SQL queries and other aspects of request processing. Furthermore, the debug toolbar has a far more advanced way of displaying the information than simply embedding it in HTML comments. The capabilities are best shown by example, so we will immediately proceed with installing the toolbar.
Installing the Django Debug Toolbar
The toolbar can be found on the Python package index site: http://pypi.python.org/pypi/django-debug-toolbar. Once installed, activating the debug toolbar in a Django project is accomplished with the addition of just a couple of settings.
First, the debug toolbar middleware, debug_toolbar.middleware.DebugToolbarMiddleware...