I have this urlConf and its working fine while accessing with a trailing slash.:
urlpatterns = patterns('', url(r'^allvideo/$','my.views.allvideo'))
Even though
APPEND_SLASH=True
it gives me attribute error "'str' object has no attribute 'resolve'", when request is made with missing trailing slash
Any idea??
APPEND_SLASH doesn't happen unconditionally -- it only comes into effect if, after trying all existing URL patterns (and the associated view, if one matches), Django is about to return a 404.
If that's the case, and the original request didn't have a slash at the end, then Django checks to see whether any URL patterns would match with a trailing slash. If so, it issues an HTTP redirect.
If any of your URL patterns match the original request (without the slash), then Django will try that one first. If that raises an exception, then you will see it (I suspect that this is what is happening). Django won't ever get to issue the redirect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With