我有一些缓存问题。我正在运行一个非常小的web应用程序,它读取一个帧,保存到磁盘,然后在浏览器窗口中显示。
我知道,这可能不是最好的解决方案,但每次我用相同的名称保存这个读取帧,因此任何浏览器都会缓存它。
我尝试使用html元标记-没有成功:
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
另外,我试过这个(特定于烧瓶):
resp.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
resp.headers["Pragma"] = "no-cache"
resp.headers["Expires"] = "0"
这就是我试图修改resp
头的方式:
r = make_response(render_template('video.html', video_info=video_info))
r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
r.headers["Pragma"] = "no-cache"
r.headers["Expires"] = "0"
Google Chrome和Safari都在做缓存。
这里可能有什么问题?
提前谢谢你
如果您总是遇到同样的问题,那么Flask在JS和CSS文件中看不到更新,因为默认情况下,Flask的最大年龄值为12小时。可以将其设置为0来解决以下问题:
有关详细信息,请参阅its documentation。
好的
最后它解决了这个问题:
如果添加此项,则在每个请求完成后将调用此函数。请看here
如果有人能解释一下为什么页面处理程序不能覆盖这些标题,我会很高兴的?
谢谢你。
相关问题 更多 >
编程相关推荐