I'm trying to retrieve an image to a html page with GET request like this:
let img = new Image();
img.onload = function () { ... };
img.src = 'http://localhost:5000/img';
and it works great on the first time when you start the server, but when I try to do this again, it returns the previous image.
My Flask part of '/img' looks like this:
@app.route('/img')
def get_img():
return send_from_directory('./tmp', 'result.png')
I made sure that the result.png on my computer is being updated, and it is. When I try to manually access 'http://localhost:5000/img', it retrieves the old image, that I've already overwritten. When I refresh 'http://localhost:5000/img', it returns the updated image that's on my computer at the moment.
This probably has nothing to do with Flask, but instead with my lacking knowledge of how HTTP works, and I'd really appreciate if someone could help me out on this one. Thanks.