Quick profiling your Django website with `debug_toolbar`
One of the projects that I've been spending a lot of time with is the django-debug-toolbar. It was started off by Rob Hudson, and since has had huge amounts of support. While my fork is quite a ways off of Rob's, they're both quite useful in their own right. To clear up one very annoying detail: This project is in no way intended to replace profiling tools or complex debugging tools like pdb. It's designed to give you quick access to general information to help debug or rough profile your web application.
I've been focusing on some of the hardcore features in panels, such as my SQL panel. MySQL users will find this especially useful, as not only do you get EXPLAIN support (provided for all backends which support it via
EXPLAIN [statement]) but you also can get a printout of all of the available indexes and their columns. It makes figuring out what's going on with your database a lot quicker.
I have also added full tracebacks for both database queries, and cache calls. Again, see the example, but it is another very helpful feature which can assist you in finding where stuff is happening within your codebase.
To try out the project, it's just a few simple actions to get it up and running:
git clone git://github.com/dcramer/django-debug-toolbar.git
'debug_toolbar.middleware.DebugToolbarMiddleware'to your middleware. It should go after your Session, Auth, and GZip middleware, but can be placed before most others.
- Login via your superuser, or use the
INTERNAL_IPSsetting to allow your user to access it. Currently
DEBUGmust also be set to true.
I very much urge anyone who's interested in the project to give feedback, as well as contribute if they so desire. There's still a lot this project can achieve, and it most certainly can be a benefit in most web applications.
Just a note, if you're using my branch, the template panel (as of writing) is non functional as I like to source everything, and it's being revamped for Django+Jinja.