Flask permanent session: where to define them?

前端 未结 3 514
闹比i
闹比i 2020-12-30 00:00

By default, Flask uses volatile sessions, which means the session cookie is set to expire when browser closes. In order to use permanent sessions, which will use a cookie

3条回答
  •  囚心锁ツ
    2020-12-30 00:14

    I choose what you said "login_user()"

    @asset.route('/login', methods=['GET', 'POST'])
    def login():
        #After Verify the validity of username and password
        session.permanent = True
    

    if it set at app.before_request, This will lead to set them too may times.

提交回复
热议问题