即使在调试模式下,Bottle 框架也会缓存我的模板
Bottle framework caches my template even in debug mode
这里有一个类似的问题,但答案已经超过 2 年了,我无法让它发挥作用。如果我遗漏了什么 - 请告诉我。
Bottle.py caching templates despite being in debug mode
每当浏览器指向 0.0.0.0:8080/16boxes 时,我需要防止缓存。 Bottle 文档说在调试模式下,缓存被禁用,但不幸的是,我的情况并非如此。
这是我的 hello.py 有问题的代码:
@route('/16boxes')
def send_static():
response.set_header('Cache-control', 'no-cache, must-revalidate')
return template (resource_path('16boxes.html'), globalVar0 = globalVar0)
run(host='0.0.0.0', port=8080, debug=True)
我打开终端 运行:python hello.py
当我 运行 它在我的 Mac/Chrome 上时它不缓存 - 但当我使用 Windows 和 Internet Explorer 时 - 它使用缓存版本。我该如何防止这种情况?
在我的 16boxes.html 中,我什至有以下内容:
<meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Pragma" content="no-cache">
您的问题是您的 JavaScript onload 事件由于浏览器缓存而在页面加载时不会触发,jQuery's ready 事件就是为此类问题创建的。
这里有一个类似的问题,但答案已经超过 2 年了,我无法让它发挥作用。如果我遗漏了什么 - 请告诉我。
Bottle.py caching templates despite being in debug mode
每当浏览器指向 0.0.0.0:8080/16boxes 时,我需要防止缓存。 Bottle 文档说在调试模式下,缓存被禁用,但不幸的是,我的情况并非如此。
这是我的 hello.py 有问题的代码:
@route('/16boxes')
def send_static():
response.set_header('Cache-control', 'no-cache, must-revalidate')
return template (resource_path('16boxes.html'), globalVar0 = globalVar0)
run(host='0.0.0.0', port=8080, debug=True)
我打开终端 运行:python hello.py
当我 运行 它在我的 Mac/Chrome 上时它不缓存 - 但当我使用 Windows 和 Internet Explorer 时 - 它使用缓存版本。我该如何防止这种情况?
在我的 16boxes.html 中,我什至有以下内容:
<meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Pragma" content="no-cache">
您的问题是您的 JavaScript onload 事件由于浏览器缓存而在页面加载时不会触发,jQuery's ready 事件就是为此类问题创建的。