#18495: 404 with non-/ WSGI, script prefix not removed in core/urlresolvers.py: resolve() -------------------------------------+------------------------------------- Reporter: django@… | Owner: nobody Type: Bug | Status: closed Component: Core (URLs) | Version: 1.4 Severity: Normal | Resolution: invalid Keywords: 404, | Triage Stage: WSGIScriptAlias, wsgi, resolve, | Unreviewed url, prefix | Needs documentation: 0 Has patch: 1 | Patch needs improvement: 0 Needs tests: 0 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+-------------------------------------
Comment (by StalkR): Thanks for the quick response. TL;DR: good news, it was my setup, sorry for the noise. I tried to build a test client without success so I went back to my setup and code and eventually found the culprit: the 404 was triggered by a custom template tag I use to resolve the current URL to a view in order to know if a view is active, from a template. Template tag: {{{ {% active request 'app.views.Home' %} }}} Code: {{{#!python @register.simple_tag def active(request, view): if resolve(request.path).url_name == view: return 'active' else: return '' }}} The fix is obviously: {{{#!python - if resolve(request.path).url_name == view: + if resolve(request.path_info).url_name == view: }}} Also I'm not using {{{reverse()}}} because unfortunately some of my URLs regexp are not reversible because using conditional parameters. So again, thanks and sorry for the noise. How could we improve the debugging message? I really like the main exception handler giving you the entire call stack with locals etc. If this was also on 404, it would have helped me locate the bug in the template tags and not think it was in the main request handler. What do you think? -- Ticket URL: <https://code.djangoproject.com/ticket/18495#comment:3> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.