Search code examples
djangodjango-urlsdjango-errors

How can I avoid the default page 404 of django?


For example when I'm in http://mydomain.com/myapp/schools/ but if you remove some of the url such as a slash, http://mydomain.com/myapp/schools the error 404 with all the urls that I have in my application and it is wrong for a page, what can I do for this? I have seen that in a django sites page does not change unless it is valid and remains in the current page.

Any idea?

Thanks :)


Solution

  • The question is not really clear but if what you want is that http://mydomain.com/myapp/schools redirects to http://mydomain.com/myapp/schools/ then make sure the APPEND_SLASH settings is set to True

    See https://docs.djangoproject.com/en/1.4/ref/settings/#append-slash