#26886: TECHNICAL_404_TEMPLATE logs an "Exception while resolving variable" warning --------------------------------------+------------------------------------ Reporter: None | Owner: None Type: Cleanup/optimization | Status: new Component: Error reporting | Version: 1.9 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------------+------------------------------------
Comment (by Sharmila G Sivakumar): Hi, I another developer who has encountered the same issue. I perused the comments on the mailing list also to see how this would be handled. I agree with the sentiment that errors need to be raised as they are good indicators of underlying issues that need to be fixed. That is true even if, overall, the system works. On the other hand it would be great if the error can be identified for what it is - An known error raised by django internals and handled accordingly. Like the contributer Antony King suggested, a single line capturing the essence of the error would suffice `` some_app/home.html:32:24: Undefined variable: missing_variable `` The reason I am suggesting this is, I am using Django 1.11 and the Template_404's error messages are drowning out all other errors. The error is basically caused by favicon.ico resulting in a 404. In the process of development, favicons are the last priority. So, the developers might have to endure the error messages for a long time. Adding a temporary favicon is a possibility, but I would rather prefer a `"GET /favicon.ico HTTP/1.1" 404 4296` message on the console to remind that favicon is not set :) I am providing an example of an exception trace from a single favicon 404 error. May be I am doing something wrong too. If so please suggest an appropriate correction. Exception while resolving variable 'name' in template 'unknown'. Traceback (most recent call last): File "/home/code/product_recco/reddit_env/lib/python3.6/site- packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/home/code/product_recco/reddit_env/lib/python3.6/site- packages/django/core/handlers/base.py", line 172, in _get_response resolver_match = resolver.resolve(request.path_info) File "/home/code/product_recco/reddit_env/lib/python3.6/site- packages/django/urls/resolvers.py", line 392, in resolve raise Resolver404({'tried': tried, 'path': new_path}) django.urls.exceptions.Resolver404: {'tried': [[<RegexURLResolver <module 'debug_toolbar.toolbar' from '/home/code/product_recco/reddit_env/lib/python3.6/site- packages/debug_toolbar/toolbar.py'> (djdt:djdt) ^__debug__/>], [<RegexURLResolver <RegexURLPattern list> (admin:admin) ^admin/>], [<RegexURLResolver <module 'userssay.urls' from '/home/code/product_recco/camerasforpros/src/recoapp/userssay/urls.py'> (None:None) ^>, <RegexURLPattern index ^$>], [<RegexURLResolver <module 'userssay.urls' from '/home/code/product_recco/camerasforpros/src/recoapp/userssay/urls.py'> (None:None) ^>, <RegexURLPattern subscribe ^subscribe$>], [<Re gexURLResolver <module 'userssay.urls' from '/home/code/product_recco/camerasforpros/src/recoapp/userssay/ urls.py'> (None:None) ^>, <RegexURLPattern search ^search$>], [<RegexURLResolver <module 'userssay.urls' f rom '/home/code/product_recco/camerasforpros/src/recoapp/userssay/urls.py'> (None:None) ^>, <RegexURLPatte rn category_most_voted ^categories/(?P<cat_slug>[a-zA-Z0-9-]+)/most- voted/$>], [<RegexURLResolver <module 'userssay.urls' from '/home/code/product_recco/camerasforpros/src/recoapp/userssay/urls.py'> (None:None) ^>, <RegexURLPattern category_most_recent ^categories/(?P<cat_slug>[a-zA-Z0-9-]+)/most-recent/$>], [<RegexU RLResolver <module 'userssay.urls' from '/home/code/product_recco/camerasforpros/src/recoapp/userssay/urls .py'> (None:None) ^>, <RegexURLPattern tag_most_voted ^tags/(?P<tag_slug>[a-zA-Z0-9-]+)/most-voted/$>], [< RegexURLResolver <module 'userssay.urls' from '/home/code/product_recco/camerasforpros/src/recoapp/userssa y/urls.py'> (None:None) ^>, <RegexURLPattern tag_most_recent ^tags/(?P<tag_slug>[a-zA-Z0-9-]+)/most-recent /$>], [<RegexURLResolver <module 'userssay.urls' from '/home/code/product_recco/camerasforpros/src/recoapp /userssay/urls.py'> (None:None) ^>, <RegexURLPattern get_product_info ^product/(?P<id_>[0-9]+)/(?P<slug>[a -zA-Z0-9-_]+)/$>], [<RegexURLResolver <module 'userssay.urls' from '/home/code/product_recco/camerasforpros/src/recoapp/userssay/urls.py'> (None:None) ^>, <RegexURLPattern get_accessories ^accessories/(?P<slug>[a -zA-Z0-9-_]+)/$>], [<RegexURLResolver <module 'userssay.urls' from '/home/code/product_recco/camerasforpro s/src/recoapp/userssay/urls.py'> (None:None) ^>, <RegexURLPattern django.contrib.sitemaps.views.sitemap ^s itemap\.xml$>], [<RegexURLPattern None ^static\/(?P<path>.*)$>]], 'path': 'favicon.ico'} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/code/product_recco/reddit_env/lib/python3.6/site- packages/django/template/base.py", line 882 , in _resolve_lookup current = current[bit] TypeError: 'RegexURLResolver' object is not subscriptable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/code/product_recco/reddit_env/lib/python3.6/site- packages/django/template/base.py", line 890 , in _resolve_lookup current = getattr(current, bit) AttributeError: 'RegexURLResolver' object has no attribute 'name' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/code/product_recco/reddit_env/lib/python3.6/site- packages/django/template/base.py", line 896, in _resolve_lookup current = current[int(bit)] ValueError: invalid literal for int() with base 10: 'name' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/code/product_recco/reddit_env/lib/python3.6/site- packages/django/template/base.py", line 903, in _resolve_lookup (bit, current)) # missing attribute django.template.base.VariableDoesNotExist: Failed lookup for key [name] in "<RegexURLResolver <module 'debug_toolbar.toolbar' from '/home/code/product_recco/reddit_env/lib/python3.6/site- packages/debug_toolbar/toolbar.py'> (djdt:djdt) ^__debug__/>" Exception while resolving variable 'name' in template 'unknown'. Traceback (most recent call last): File "/home/code/product_recco/reddit_env/lib/python3.6/site- packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/home/code/product_recco/reddit_env/lib/python3.6/site- packages/django/core/handlers/base.py", line 172, in _get_response resolver_match = resolver.resolve(request.path_info) File "/home/code/product_recco/reddit_env/lib/python3.6/site- packages/django/urls/resolvers.py", line 392, in resolve raise Resolver404({'tried': tried, 'path': new_path}) django.urls.exceptions.Resolver404: {'tried': [.....................huge..list..of..urls..removed.........................], 'path': 'favicon.ico'} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/code/product_recco/reddit_env/lib/python3.6/site- packages/django/template/base.py", line 882, in _resolve_lookup current = current[bit] TypeError: 'RegexURLResolver' object is not subscriptable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/code/product_recco/reddit_env/lib/python3.6/site- packages/django/template/base.py", line 890, in _resolve_lookup current = getattr(current, bit) AttributeError: 'RegexURLResolver' object has no attribute 'name' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/code/product_recco/reddit_env/lib/python3.6/site- packages/django/template/base.py", line 896, in _resolve_lookup current = current[int(bit)] ValueError: invalid literal for int() with base 10: 'name' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/code/product_recco/reddit_env/lib/python3.6/site- packages/django/template/base.py", line 903, in _resolve_lookup (bit, current)) # missing attribute django.template.base.VariableDoesNotExist: Failed lookup for key [name] in '<RegexURLResolver <RegexURLPattern list> (admin:admin) ^admin/>' Not Found: /favicon.ico "GET /favicon.ico HTTP/1.1" 404 4296 -- Ticket URL: <https://code.djangoproject.com/ticket/26886#comment:7> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.f1c76fe69a78628f8ad1455bd71aed1b%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.