Flask Snippets

Snippets are unofficial and unmaintained.

This is an archived view of user-submitted snippets. Despite being hosted on the Flask site, they are not official. No Flask maintainer has curated or checked the snippets for security, correctness, or design.

Flask Set Cookies by Response

Posted by liuliang on 2010-06-28 @ 15:03 and filed in Utilities

@app.route('/set_cookie')
def cookie_insertion():
    redirect_to_index = redirect('/index')
    response = current_app.make_response(redirect_to_index )  
    response.set_cookie('cookie_name',value='values')
    return response

This snippet by liuliang can be used freely for anything you like. Consider it public domain.

Comments