Flask Login errors: Undefined variable 'login_user' // NameError: name 'login_user' is not defined

Viewed 633

I'm trying to use Flask login but running into an issue with calling login_user(). VSCode shows this error:

error

And when I try to run the app. I get this error:

NameError: name 'login_user' is not defined.

Usually I would think the error is because I didn't import the right module, but I'm pretty sure I have the right one:

from flask_login import LoginManager, current_user, UserMixin

I have also used pip3 install flask-login. Does anyone know what I'm doing wrong here? Thanks so much!

Could it be that the import is not working correctly for some reason?

0 Answers
Related