Django trailing slash and 404
What's inside this article
⌄
- Django admin 404
- URL trailing slash
- Error 404 not found
- URL not found
URLs can have (or do not have) trailing slashes:
The thing is that they are considered different URLs and can lead to different content.
Initially, it was implied that a URL with a trailing slash should indicate a directory, and a URL without a slash should indicate a file.
However, you can see this behavior vary from time to time. Let’s look at the Django admin url: http://127.0.0.1:8000/admin/. It has a trailing slash.
Moreover, there is no page located under http://127.0.0.1:8000/admin.
That may be the reason you receive a 404 when trying to open Django admin.
If you own a website or a web service, dive a little further into this topic. For example, you may want to configure a 301 HTTP return code.