Django 管理怪异(URL 中间歇性缺少“admin”)
很抱歉,如果有人认识这个问题,但我无法在任何地方找到它。
我一直在尝试 django 站点,最近发现一个问题,当我第一次登录管理界面时,管理表中的链接都缺少 URL 的“/admin/”部分。但是,如果我注销并重新登录,或者如果我手动将“/admin/”部分添加到 URL,则它可以正常工作。例如,“auth”链接将显示为“locahost/auth”而不是“localhost/admin/auth”。
我已经调试了sites.py 和index.html 模板,发现第一次和第二次登录时都传入了相同的url。我不太明白为什么会发生这种情况。它并不总是发生,但我一直无法弄清楚我做了什么导致了它。
我还应该提到,它的发生与我用来访问它的浏览器无关,并且无论我使用 django 开发服务器还是 apache 服务器,它都会发生。
有人对我应该看什么有一些想法吗?谢谢。
Sorry if someone recognizes this question, but I couldn't locate it anywhere.
I have been experimenting with django sites and have recently seen a problem where the first time I login to the admin interface, the links in the admin table are all missing the "/admin/" portion of the URL. However, if I logout and back in, or if I manually add the "/admin/" portion to the URL, it works fine. For example, the "auth" link will come up as "locahost/auth" instead of "localhost/admin/auth".
I have debugged the sites.py and index.html template and see that the same url is passed in on both the first and second login. I don't quite understand why this is happening. It did not always happen, but I have not been able to figure out what I did to cause it.
I should also mention, it happens independent of the browser I use to access it and it happens whether I am using the django development server or an apache server.
Anybody got some thoughts on what I should look at? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是为了结束这一切。问题是我的管理视图的 url 模式匹配错误。我的模式是
'^admin$'
而不是'^admin/'
。Just to close this out. The problem was that I had a bad url pattern match for the admin views. I had a pattern of
'^admin$'
instead of'^admin/'
.