DEV Community

sunj
sunj

Posted on

Flask cookie

from flask import request

@app.route('/')
def index():
    username = request.cookies.get('username')
Enter fullscreen mode Exit fullscreen mode

쿠키를 읽을 때

from flask import make_response

@app.route('/')
def index():
    resp = make_response(render_template(...))
    resp.set_cookie('username', 'the username')
    return resp
Enter fullscreen mode Exit fullscreen mode

쿠키 저장

참조 : https://flask-docs-kr.readthedocs.io/ko/latest/quickstart.html#id11

Top comments (0)