django urls without a trailing slash do not redirect


I've got two applications located on two separate computers. On computer A, in the file I have a line like the following:

(r'^cast/$', 'mySite.simulate.views.cast')

And that url will work for both and But on computer B I have a similar url written out like:

(r'^login/$', 'mySite.myUser.views.login')

For some reason on computer B the url will work but will hang and won't direct back to like it will on computer A. Is there something I missed? Both files look identical to me.

4/26/2013 8:17:25 PM

Accepted Answer

check your APPEND_SLASH setting in the file

more info in the django docs

10/20/2009 6:49:39 PM

Or you can write your urls like this:

(r'^login/?$', 'mySite.myUser.views.login')

The question sign after the trailing slash makes it optional in regexp. Use it if for some reasons you don't want to use APPEND_SLASH setting.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow