您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

在Flask中禁用缓存

在Flask中禁用缓存

好,

最终它与这个工作:

@app.after_request
def add_header(r):
    """
    Add headers to both force latest IE rendering engine or Chrome Frame,
    and also to cache the rendered page for 10 minutes.
    """
    r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
    r.headers["Pragma"] = "no-cache"
    r.headers["Expires"] = "0"
    r.headers['Cache-Control'] = 'public, max-age=0'
    return r

如果添加此选项,则在完成每个请求后将调用函数。请看这里

如果有人能向我解释为什么页头处理程序无法覆盖标题,我会很高兴?

谢谢。

Python 2022/1/1 18:32:12 有253人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶