Search code examples
pythonflaskflask-login

flask-login session gets destroyed on every apache restart


I am using flask-login https://github.com/maxcountryman/flask-login and the field remember in login_user does not seem to work.

The session gets destroyed after every restart of the apache ..ideally the remember field should take care of this.. even the session values gets destroyed. this is really frustrating... anyone knowing the solution please ping .. thanks i am using login_user as

login_user(user, remember=True)

Solution

  • If anyone is suffering with this problem, you have to write the function user_loader properly.

    @login_manager.user_loader
    def load_user(id):
        return "get the user properly and create the usermixin object"