Enable showing stacktraces locals - #1203
Conversation
fe55ef9 to
425f30d
Compare
425f30d to
7ce3b45
Compare
|
I like the idea, though I think it might be worth to format the dict in the template. Otherwise as you mentioned, it will likely be noisy and difficult to read. What do you think? |
|
I agree. Sent a commit to improve it. In order to not try to parse |
tim-schilling
left a comment
There was a problem hiding this comment.
This still needs to be reviewed by a more involved contributor before it can be merged. Another concern is that the locals could expose sensitive information. While this isn't such a big deal while running this locally, it could be problematic if it were run on a production server and/or a server that's not running https. Maybe including this in a caution segment in the docs would suffice?
However, this should also include tests for the locals being included for both the sql and cache panels.
|
@matthiask What's your opinion of this idea? |
|
@tim-schilling This would surely have helped me at times too. I always revert to |
Code review suggestions for django-commons#1203
|
Hi @tim-schilling I added your commits, fixed an issue and added some tests (not sure if they are enough). Let me know what you think |
tim-schilling
left a comment
There was a problem hiding this comment.
This looks good. I'm going to rebase on upstream/master, squash the commits and merge it to master. Thanks @jperelli for the PR!
|
Merged with fd50ce3 |
|
Thank you! Can't wait to see it live :) |

Hi! I added a config variable to be able to see the locals inside the stacktraces.
The motivation for this was to be able to find duplicated queries by having more context. In my case this helped debugging django-rest-framework query duplication, see the pic below.
I had no clue why the queries were being duplicated, but with local()s I'm able now to see that it's in a
Matchexceptionmodel and when trying to get thefeetypeattribute. After this, it was an easy fix.I added the configuration as disabled by default because it is too verbose for most cases, but it is very useful for when issues are getting difficult to spot, enable it one time, fix the issue and disable it again.