【发布时间】:2016-08-22 23:57:43
【问题描述】:
我在 python 中有一个 web 应用程序,web 服务器是用库 web.py 实现的。
但是,当浏览器向网络服务器发送请求时,例如在 /static/index.html 上,它会在 http 标头中包含字段 'IF-MATCH-NONE' 和 'IF-MODIFIED-SINCE' 和服务器检查自上次以来 html 页面请求是否已被修改(以及服务器响应 http 304 - 未修改)...
如何在任何情况下强制响应 html 页面,即使它没有被修改?
网络服务器的代码如下。
import web
urls= (
'/', 'redirect',
'/static/*','index2',
'/home/','process'
)
app=web.application(urls,globals())
class redirect:
def GET(self):
..
return web.redirect("/static/index.html")
def POST(self):
..
raise web.seeother("/static/index.html")
class index2:
def GET(self):
...
some checks
....
if __name__=="__main__":
app.run()
【问题讨论】:
-
作为权宜之计,您可以将流行的 Web 浏览器配置为在“开发者控制台”打开时禁用缓存。这对我来说已经足够了。
标签: python http caching web.py http-status-code-304