Re: Unhelpful template traceback
For posterity, I think the link should have been https://code.djangoproject.com/ticket/11461. David On Monday, January 4, 2010 11:14:24 AM UTC-8, Margie Roginski wrote: > > > I had also noticed that errors from templates were quite hard to > debug. Some time ago I saw this thread on on this group: > > > http://groups.google.com/group/django-users/browse_thread/thread/ee29c542dcc0dc95/aaa3f89a2a77fa3f?lnk=gst=template_debug#aaa3f89a2a77fa3f > > I applied the very simple patch, which is listed in > http://code.djangoproject.com/ticket/11451 > > (Here's my own notes on what the patch is) > File: /site-packages/django/template/debug.py > > # raise wrapped # remove this line, add next line, see ticket > 11451 > raise wrapped, None, wrapped.exc_info[2] > > After applying this patch I found the the traceback errors made much > more sense. The tracebacks are complete now and point me to a line > that is meaningful. > > I believe this is some sort of issue only with python 2.6, so if you > are not on 2.6, it is probably not a solution for you, but if you are > on 2.6, give it a try. > > Margie > > > On Jan 4, 9:08 am, Thomas Steinacherwrote: > > The actual error is not my point. I know that it's somewhere in a > > reverse/url method, but there is no way I can test it. The point is > > that there is no helpful template traceback in the deployment error e- > > mails. Maybe I should direct this to django-developers instead or file > > a ticket? > > > > On Jan 4, 6:05 pm, Victor Loureiro Lima > > wrote: > > > > > You are probably calling {{ model.property.url }} or {{ > > > model.get_absolute_url }} on some property/model (either FileField or > > > ImageField in case of property) of some model of yours that doesnt > know how > > > to reverse back to its URL, so the template gives an error because it > doesnt > > > know how to render its own value. You should check if the models is > correct > > > and if its possible to access it thru the regex of URL. > > > > > Maybe if you iterate thru all objects trying to get_absolute_url them > you > > > could reproduce some sort of error. > > > > > That would be my guess =) > > > > > Victor Lima > > > > > 2010/1/4 Thomas Steinacher > > > > > > Hey guys, > > > > > > I sometimes get errors which occur rarely, so it is very difficult to > > > > reproduce them in a development environment. The traceback always > > > > looks similar to the traceback attached below (which is just an > > > > example). > > > > > > My question: How can I make the Django error mails show the template > > > > file name and line number where the error occurred? It is really > > > > annoying as I currently see no way to debug this type of errors other > > > > than guessing, which is very difficult, especially when templates are > > > > very complex. > > > > > > Thanks, > > > > > > Thomas > > > > > > File "/home/mysite/django-mysite3/django/template/loader.py", line > > > > 173, in render_to_string > > > > return t.render(context_instance) > > > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > > 184, in render > > > > return self._render(context) > > > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > > 178, in _render > > > > return self.nodelist.render(context) > > > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > > 787, in render > > > > bits.append(self.render_node(node, context)) > > > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > > 800, in render_node > > > > return node.render(context) > > > > > > File "/home/mysite/django-mysite3/django/template/defaulttags.py", > > > > line 384, in render > > > > raise e > > > > > > NoReverseMatch: Reverse for 'view_user_pictures' with arguments '()' > > > > and keyword arguments '{'username': ''}' not found. > > > > > > -- > > > > > > You received this message because you are subscribed to the Google > Groups > > > > "Django users" group. > > > > To post to this group, send email to > > > > django...@googlegroups.com > . > > > > To unsubscribe from this group, send email to > > > > django-users...@googlegroups.com > > > > groups.com> > > > > . > > > > For more options, visit this group at > > > >http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/6-2dg_wnYAoJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Unhelpful template traceback
I had also noticed that errors from templates were quite hard to debug. Some time ago I saw this thread on on this group: http://groups.google.com/group/django-users/browse_thread/thread/ee29c542dcc0dc95/aaa3f89a2a77fa3f?lnk=gst=template_debug#aaa3f89a2a77fa3f I applied the very simple patch, which is listed in http://code.djangoproject.com/ticket/11451 (Here's my own notes on what the patch is) File: /site-packages/django/template/debug.py # raise wrapped # remove this line, add next line, see ticket 11451 raise wrapped, None, wrapped.exc_info[2] After applying this patch I found the the traceback errors made much more sense. The tracebacks are complete now and point me to a line that is meaningful. I believe this is some sort of issue only with python 2.6, so if you are not on 2.6, it is probably not a solution for you, but if you are on 2.6, give it a try. Margie On Jan 4, 9:08 am, Thomas Steinacherwrote: > The actual error is not my point. I know that it's somewhere in a > reverse/url method, but there is no way I can test it. The point is > that there is no helpful template traceback in the deployment error e- > mails. Maybe I should direct this to django-developers instead or file > a ticket? > > On Jan 4, 6:05 pm, Victor Loureiro Lima > wrote: > > > You are probably calling {{ model.property.url }} or {{ > > model.get_absolute_url }} on some property/model (either FileField or > > ImageField in case of property) of some model of yours that doesnt know how > > to reverse back to its URL, so the template gives an error because it doesnt > > know how to render its own value. You should check if the models is correct > > and if its possible to access it thru the regex of URL. > > > Maybe if you iterate thru all objects trying to get_absolute_url them you > > could reproduce some sort of error. > > > That would be my guess =) > > > Victor Lima > > > 2010/1/4 Thomas Steinacher > > > > Hey guys, > > > > I sometimes get errors which occur rarely, so it is very difficult to > > > reproduce them in a development environment. The traceback always > > > looks similar to the traceback attached below (which is just an > > > example). > > > > My question: How can I make the Django error mails show the template > > > file name and line number where the error occurred? It is really > > > annoying as I currently see no way to debug this type of errors other > > > than guessing, which is very difficult, especially when templates are > > > very complex. > > > > Thanks, > > > > Thomas > > > > File "/home/mysite/django-mysite3/django/template/loader.py", line > > > 173, in render_to_string > > > return t.render(context_instance) > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 184, in render > > > return self._render(context) > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 178, in _render > > > return self.nodelist.render(context) > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 787, in render > > > bits.append(self.render_node(node, context)) > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 800, in render_node > > > return node.render(context) > > > > File "/home/mysite/django-mysite3/django/template/defaulttags.py", > > > line 384, in render > > > raise e > > > > NoReverseMatch: Reverse for 'view_user_pictures' with arguments '()' > > > and keyword arguments '{'username': ''}' not found. > > > > -- > > > > You received this message because you are subscribed to the Google Groups > > > "Django users" group. > > > To post to this group, send email to django-us...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > django-users+unsubscr...@googlegroups.com > > groups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Unhelpful template traceback
Yes, maybe thats more like the case. Victor Lima 2010/1/4 Thomas Steinacher> The actual error is not my point. I know that it's somewhere in a > reverse/url method, but there is no way I can test it. The point is > that there is no helpful template traceback in the deployment error e- > mails. Maybe I should direct this to django-developers instead or file > a ticket? > > On Jan 4, 6:05 pm, Victor Loureiro Lima > wrote: > > You are probably calling {{ model.property.url }} or {{ > > model.get_absolute_url }} on some property/model (either FileField or > > ImageField in case of property) of some model of yours that doesnt know > how > > to reverse back to its URL, so the template gives an error because it > doesnt > > know how to render its own value. You should check if the models is > correct > > and if its possible to access it thru the regex of URL. > > > > Maybe if you iterate thru all objects trying to get_absolute_url them > you > > could reproduce some sort of error. > > > > That would be my guess =) > > > > Victor Lima > > > > 2010/1/4 Thomas Steinacher > > > > > > > > > Hey guys, > > > > > I sometimes get errors which occur rarely, so it is very difficult to > > > reproduce them in a development environment. The traceback always > > > looks similar to the traceback attached below (which is just an > > > example). > > > > > My question: How can I make the Django error mails show the template > > > file name and line number where the error occurred? It is really > > > annoying as I currently see no way to debug this type of errors other > > > than guessing, which is very difficult, especially when templates are > > > very complex. > > > > > Thanks, > > > > > Thomas > > > > > File "/home/mysite/django-mysite3/django/template/loader.py", line > > > 173, in render_to_string > > > return t.render(context_instance) > > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 184, in render > > > return self._render(context) > > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 178, in _render > > > return self.nodelist.render(context) > > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 787, in render > > > bits.append(self.render_node(node, context)) > > > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > > 800, in render_node > > > return node.render(context) > > > > > File "/home/mysite/django-mysite3/django/template/defaulttags.py", > > > line 384, in render > > > raise e > > > > > NoReverseMatch: Reverse for 'view_user_pictures' with arguments '()' > > > and keyword arguments '{'username': ''}' not found. > > > > > -- > > > > > You received this message because you are subscribed to the Google > Groups > > > "Django users" group. > > > To post to this group, send email to django-us...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > django-users+unsubscr...@googlegroups.com > > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/django-users?hl=en. > > -- > > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Unhelpful template traceback
The actual error is not my point. I know that it's somewhere in a reverse/url method, but there is no way I can test it. The point is that there is no helpful template traceback in the deployment error e- mails. Maybe I should direct this to django-developers instead or file a ticket? On Jan 4, 6:05 pm, Victor Loureiro Limawrote: > You are probably calling {{ model.property.url }} or {{ > model.get_absolute_url }} on some property/model (either FileField or > ImageField in case of property) of some model of yours that doesnt know how > to reverse back to its URL, so the template gives an error because it doesnt > know how to render its own value. You should check if the models is correct > and if its possible to access it thru the regex of URL. > > Maybe if you iterate thru all objects trying to get_absolute_url them you > could reproduce some sort of error. > > That would be my guess =) > > Victor Lima > > 2010/1/4 Thomas Steinacher > > > > > Hey guys, > > > I sometimes get errors which occur rarely, so it is very difficult to > > reproduce them in a development environment. The traceback always > > looks similar to the traceback attached below (which is just an > > example). > > > My question: How can I make the Django error mails show the template > > file name and line number where the error occurred? It is really > > annoying as I currently see no way to debug this type of errors other > > than guessing, which is very difficult, especially when templates are > > very complex. > > > Thanks, > > > Thomas > > > File "/home/mysite/django-mysite3/django/template/loader.py", line > > 173, in render_to_string > > return t.render(context_instance) > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > 184, in render > > return self._render(context) > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > 178, in _render > > return self.nodelist.render(context) > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > 787, in render > > bits.append(self.render_node(node, context)) > > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > > 800, in render_node > > return node.render(context) > > > File "/home/mysite/django-mysite3/django/template/defaulttags.py", > > line 384, in render > > raise e > > > NoReverseMatch: Reverse for 'view_user_pictures' with arguments '()' > > and keyword arguments '{'username': ''}' not found. > > > -- > > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com > groups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Unhelpful template traceback
You are probably calling {{ model.property.url }} or {{ model.get_absolute_url }} on some property/model (either FileField or ImageField in case of property) of some model of yours that doesnt know how to reverse back to its URL, so the template gives an error because it doesnt know how to render its own value. You should check if the models is correct and if its possible to access it thru the regex of URL. Maybe if you iterate thru all objects trying to get_absolute_url them you could reproduce some sort of error. That would be my guess =) Victor Lima 2010/1/4 Thomas Steinacher> Hey guys, > > I sometimes get errors which occur rarely, so it is very difficult to > reproduce them in a development environment. The traceback always > looks similar to the traceback attached below (which is just an > example). > > My question: How can I make the Django error mails show the template > file name and line number where the error occurred? It is really > annoying as I currently see no way to debug this type of errors other > than guessing, which is very difficult, especially when templates are > very complex. > > Thanks, > > Thomas > > > > File "/home/mysite/django-mysite3/django/template/loader.py", line > 173, in render_to_string > return t.render(context_instance) > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > 184, in render > return self._render(context) > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > 178, in _render > return self.nodelist.render(context) > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > 787, in render > bits.append(self.render_node(node, context)) > > File "/home/mysite/django-mysite3/django/template/__init__.py", line > 800, in render_node > return node.render(context) > > File "/home/mysite/django-mysite3/django/template/defaulttags.py", > line 384, in render > raise e > > NoReverseMatch: Reverse for 'view_user_pictures' with arguments '()' > and keyword arguments '{'username': ''}' not found. > > -- > > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Unhelpful template traceback
Hey guys, I sometimes get errors which occur rarely, so it is very difficult to reproduce them in a development environment. The traceback always looks similar to the traceback attached below (which is just an example). My question: How can I make the Django error mails show the template file name and line number where the error occurred? It is really annoying as I currently see no way to debug this type of errors other than guessing, which is very difficult, especially when templates are very complex. Thanks, Thomas File "/home/mysite/django-mysite3/django/template/loader.py", line 173, in render_to_string return t.render(context_instance) File "/home/mysite/django-mysite3/django/template/__init__.py", line 184, in render return self._render(context) File "/home/mysite/django-mysite3/django/template/__init__.py", line 178, in _render return self.nodelist.render(context) File "/home/mysite/django-mysite3/django/template/__init__.py", line 787, in render bits.append(self.render_node(node, context)) File "/home/mysite/django-mysite3/django/template/__init__.py", line 800, in render_node return node.render(context) File "/home/mysite/django-mysite3/django/template/defaulttags.py", line 384, in render raise e NoReverseMatch: Reverse for 'view_user_pictures' with arguments '()' and keyword arguments '{'username': ''}' not found. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.