php header('Refresh: 1;url=destination'); in Flask + python? php header('Refresh: 1;url=destination'); in Flask + python? flask flask

php header('Refresh: 1;url=destination'); in Flask + python?


All header() does is add a HTTP header to the response. You can do so in Flask too.

Either return a tuple of (body, status, headers) or return a flask.Response() object. See About Responses in the quickstart.

Example with a body, status and headers tuple:

body = render_template('sometemplate', somevar=somevalue)return (body, 200, {'Refresh': '1;url=destination'})

Here the second element sets a 200 status code (success), and the third is a dictionary specifying the Refresh header.