How can I debug the "Exception when resolving a variable in the" unknown "template?

I keep seeing

DEBUG Exception while resolving variable 'exception_type' in template 'unknown'. 

in my django logs and then

 VariableDoesNotExist: Failed lookup for key [exception_type] in 

followed by a string representation of the list of dictionaries containing the query, and the entire settings.py file.

Another example:

 DEBUG Exception while resolving variable 'lastframe' in template 'unknown' 

I feel like I just don’t have enough information to debug this. All I know is a variable called exception_type in an unknown template. My code does not contain the string "exception_type" anywhere.

How can I debug this? Where should I look?

  • Ubuntu 14.04
  • Python 2.7.6
  • Django 1.11
+7
source share
1 answer

the point was not a variable 'lastframe' or a variable 'exception_type'
You have to check your URL, all URLs, not only the internal URL, but also the external URL. keep an eye on front-end URLs and middleware (if you wrote your own middleware files, the best way to check is to check the administrator at your URL). I had the same question, when I checked the URL and middleware, I solved the problem easily.

Hope this helps you

0
source

Source: https://habr.com/ru/post/1267236/


All Articles