Python 为什么';html看不到来自flask路由的新图像吗?

Python 为什么';html看不到来自flask路由的新图像吗?,python,html,flask,Python,Html,Flask,每次我用Flask重新加载html时,我都试图生成一个新的图像。 我的html是这样的 <img src="/getLinearImage" alt="User Image" height="100px" width="100px"> 和getImage()返回带有send\u file()方法的图像。当我转到url并刷新页面时,图像会发生更改,但当html访问页面时,它不会在页面刷新时生成新图像。知道

每次我用Flask重新加载html时,我都试图生成一个新的图像。 我的html是这样的

<img src="/getLinearImage" alt="User Image" height="100px" width="100px">

getImage()返回带有send\u file()方法的图像。当我转到url并刷新页面时,图像会发生更改,但当html访问页面时,它不会在页面刷新时生成新图像。知道为什么会发生这种情况吗?

要排除浏览器缓存第一幅图像的可能性,请尝试重写

return getImage(getLinearImage())
作为


“html访问页面它不会在页面刷新时生成新图像”这意味着什么,“html访问页面”据我理解,当html图像的源是烧瓶路径时,它将转到该路径并插入文件。然而,在这种情况下,它会继续插入缓存的图像,而不去生成新图像的路径。多亏了这一点,它工作得非常好。这些图像正在缓存中,无法通过html访问
return getImage(getLinearImage())
response = getImage(getLinearImage())
response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'
return response