Skip to content Skip to sidebar Skip to footer

How Do I Display A Newly Saved Image Using Opencv From Flask In The Static Folder?

I'm trying to take image input and do some processing on it before displaying the output on the webpage. However, when I try a different image, the older image is displayed instead

Solution 1:

You need to disable cache

def process():
    ....
    resp = make_response(render_template('out.html'))
    resp.cache_control.no_cache = True
    return resp

Updated

classMyFlask(Flask):defget_send_file_max_age(self, name):
        if name == 'out.jpg':
            return0return Flask.get_send_file_max_age(self, name)

app = MyFlask(__name__)

Post a Comment for "How Do I Display A Newly Saved Image Using Opencv From Flask In The Static Folder?"