django 1.4缓存GET到/ login / [英] django 1.4 caching GET to /login/

查看:142
本文介绍了django 1.4缓存GET到/ login /的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将我的django框架从1.3升级到1.4。今天我在登录页面上进行了一些测试。我有一个开关,它确定是否应该在登录屏幕上显示重置密码链接。这个测试在1.3以下很好地工作,但不低于1.4。



我已经为登录页面设置了自己的视图和模板,如下所示:

  urlpatterns = patterns('framework.views',
url(r'^ $','index'),
url(r'^ login / $','login_view'),
url(r'^ logout / $','logout_view'),
...

进一步调查后,我注意到,如果我第一次浏览登录页面,它可以工作,如果我从我的网址中删除条目.py文件(即/ login / entries),我仍然可以浏览到/ login / page,即使重新启动django测试服务器,该url条目仍然有效,即使删除urls.pyc文件也不会我是一个404.它只有当我尝试和发布,我会得到一个404.顺便说一句,这种现象不会发生在我的其他一些网址。



我有一种感觉,我的测试失败的原因是django以某种方式缓存/ login / request神秘的方式,所以登录页面不会刷新我在屏幕上运行的每个测试。有没有人知道如何克服这个问题,也许是为什么这个特殊的功能已经改变了。它是否与新实施的模板响应?有任何关系?

解决方案

你是否使用firefox?尝试删除Firefox缓存,或您正在使用的任何浏览器缓存...



我昨天遇到同样的问题。我环顾四周,发现很多人都有这个问题。看看这个 ...



不要像以前那样把责任归咎于django;)(我以后怪我,知道真正的问题)...



协议:P



希望解决您的问题!



编辑:
这里你有一些可能的解决方案你的问题(如果你使用firefox):



1) http://support.mozilla.org/es/questions/848678



2) https://superuser.com/questions/23134/how-to-turn-off- firefox-cache


I recently upgraded my django framework from 1.3 to 1.4. Today I ran some tests on the login page. I have a switch which determines whether a 'reset password' link should be displayed on the login screen. This test worked nicely under 1.3, but doesn't under 1.4.

I've setup my own view and template for the login page as follows:

urlpatterns = patterns('framework.views',
    url(r'^$', 'index'),
    url(r'^login/$', 'login_view'),
    url(r'^logout/$', 'logout_view'),
...

Upon some further investigation I noticed that if I browse to the login page the first time, it works. If I then remove the entries from my urls.py file (ie the /login/ entries), I can still browse to the /login/ page. Even when I restart the django test server, that url entry is still valid. Even deleting the urls.pyc file doesn't give me a 404. Its only when I try and post, that I'll get a 404. Incidentally, this phenomenon doesn't happen for some of my other urls.

I have a feeling the reason why my tests fail is that django somehow caches the /login/ request in some mysterious way and so the login page never refreshes for each of the tests I run on the screen. Does anybody know how to overcome this problem and perhaps also why it is that this particular feature has changed. Does it have anything to do with the newly implemented template response??

解决方案

Do you use firefox? Try to remove Firefox cache, or whatever browser's cache you are using...

I ran into the same issue yesterday. I look around and i found a lot of people having this issue. Have a look at this...

Don't blame django as i did in first place ;) (i blamed me later, before knowing the real problem)...

Let's blame the protocol :P

Hope this solves your problem!

EDIT: Here you have some possible solutions to your problem (if you use firefox):

1) http://support.mozilla.org/es/questions/848678

2) https://superuser.com/questions/23134/how-to-turn-off-firefox-cache

这篇关于django 1.4缓存GET到/ login /的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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