django - 具有自动斜线添加的网址 [英] django - url with automatic slash adding

查看:111
本文介绍了django - 具有自动斜线添加的网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站上使用django管理员。当我输入管理员后没有斜杠的URL( http://example.com/admin )时,我收到404错误。我以为django在url的末尾自动添加斜杠。当然,当我输入url以斜杠结束时,它可以正常工作。我做错了什么,哪些设置我要改变。感谢任何想法。

解决方案

尝试在设置中将APPEND_SLASH设置为true。在第二个想法中,我认为默认设置为true。



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


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.

解决方案

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

这篇关于django - 具有自动斜线添加的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆