django - url with automatic slash adding

12,273

Try setting APPEND_SLASH to true in settings. On second thoughts, I think the default setting is true.

http://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs

Share:
12,273
lukasz
Author by

lukasz

Updated on June 13, 2022

Comments

  • lukasz
    lukasz almost 2 years

    I'm using django admin on my website. When I enter url without slash after admin (http://example.com/admin) I receive 404 error. I thought that django automatically added slash on the end of url. Of course when I enter url ended with slash it works fine. What I am doing wrong, or which settings I have to change. Thanks for any ideas.

  • lukasz
    lukasz over 13 years
    Thanks for quick replay. I have put APPEND_SLASH into settings (commonmidelware also is putted) but unfortunately still the same. maybe mod_python has problem with redirecting from 'admin' into 'admin/'?
  • lukasz
    lukasz over 13 years
    I noticed that this happend to all link on my website. not olny admin. When I enter section name not ended with slash, slash didn't add automatically (the difference is that I don't have 404 but it is coused by rule in urls.py)
  • Sriram
    Sriram over 13 years
    Does this happen when you use django's built in webserver or only when you run on Apache?
  • Dominic Rodger
    Dominic Rodger over 13 years
    Stop using mod_python. I don't know if that's the reason you're having problems, but support for mod_python is deprecated and will be removed in Django 1.5 (docs.djangoproject.com/en/dev/howto/deployment/modpython).
  • lukasz
    lukasz over 13 years
    Sriam, I have to check it. Now I only work on mod_python. Thanks. Dominic thanks for info, I will try to change server into mod_wsgi but it depends on my host provider.
  • lukasz
    lukasz over 13 years
    Problem has bessn solved. My mistake in urlsy.py. Thank you for your advieces.
  • Ahmed Wagdi
    Ahmed Wagdi about 2 years
    @lukasz can you tell what was the mistake because am having the same problem