@app.after_request
def after_request(response):
    diff = int((time.time() - g.start) * 1000)
if response.response and response.content_type.startswith('text/html'
    ) and response.status_code == 200:
    response.response[0] = response.response[0].replace('__EXECUTION_TIME__',
        str(diff))
return response
Calculate execution time for every page in Python's Flask