Index ¦ Archives  ¦ Atom  ¦ RSS

Django debug toolbar Profiling

I spent the past half-hour trying to debug a problem that turned out to be from debugging, profiling to be exact. If you're doing a quick google for profiling with django-debug-toolbar, you may be tempted to use adurdin's Profiling Panel. I'm writing this to tell you to WATCH OUT!!

Now, this isn't personal, so sorry adurdin, but your panel can break things. It runs the view twice, no matter what view, which means if you are adding new objects in the view, you're gonna get two new objects and have no clue why it's happening. I thought I had somehow pushed a bug into the admin site as I kept making two of everything, no matter what.

This may be a drawback of profiling outside of middleware, I can't find any django-debug-toolbar based profiling systems that don't call the view twice, but it likely is possible inside of a middleware that pushes its data over to a panel on the far end of a request.

There was a promise made for a singe-call panel but after trying it, there's no fix for the double-call nor does it even work with the latest debug-toolbar. If anybody knows of a profiling debug-toolbar panel (or writes one), comment below and I'll write a post and publicize it.


© Fahrzin Hemmati. Built using Pelican. Theme by Giulio Fidente on github.