[Answer]-Django weird url call error

1👍

First of all, it would be a good idea to link to your previous post and mention you are using a hack that I gave you, because (A) it’s not normal setup and (B) Someone might come up with a better idea than mine

Secondly, you’re seeing this behaviour because of normal url processing. See, the urls mysite.com/something and mysite.com/something/ are not the same. To match it with django’s urls, the difference would be:

url(r'^something/$')
url(r'^something$')

Since the difference is so minor, when using a normal setup, after failing to find the a url without a forward slash django’s common middlewere* will automatically try to add one and test it. It’s only then that it would give up and forward you to a 404 page.

However, in your setup, the catch-all url prevents the second round because it does apply to the url without the forward slash. My solution? Don’t worry about it. The only reason you’re using this hack is because Debug=True means a debug page instead of your custom 404 page, a problem you won’t be facing when moving to a production environment

*and a big thanks to @Alasdair who pointed this out in the comments

👤yuvi

Leave a comment