flask-login: can't understand how it works

后端 未结 5 1700
离开以前
离开以前 2020-12-02 05:01

I\'m trying to understand how Flask-Login works.

I see in their documentation that they use a pre-populated list of users. I want to play with a database-stored user

5条回答
  •  臣服心动
    2020-12-02 05:41

    Here is a Flask example of using login: https://bitbucket.org/leafstorm/flask-login/src/3160dbfc7cfc/example/login-example.py You need to use @login_required for every method that requires login. For example,

    @app.route('/make-login')
    @login_required
    def make_login():
        ...
    

提交回复
热议问题