Python Forum
Flask: No user_loader has been installed for this LoginManager
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flask: No user_loader has been installed for this LoginManager
#11
It's 11 P.M. in my part of the world now, and I'm too tired tonight to figure be of much help.

Here's a couple of ideas:

how to you start flask on windows, do you use flask run?
if so, I'm wondering if it's your FLASK_APP environment variable is set up
it should be set to microblog.py

Also, was the error that you first posted complete?
If not, post entire error.
Reply
#12
yes, flask run

Error:
Exception Exception: No user_loader has been installed for this LoginManager. Refer tohttps://flask-login.readthedocs.io/en/latest/#how-it-works for more info. Traceback (most recent call last) File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\flask\app.py", line 2463, in __call__ return self.wsgi_app(environ, start_response) File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\flask\app.py", line 2449, in wsgi_app response = self.handle_exception(e) File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\flask\app.py", line 1866, in handle_exception reraise(exc_type, exc_value, tb) File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\flask\_compat.py", line 39, in reraise raise value File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\flask\app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\flask\app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\flask\_compat.py", line 39, in reraise raise value File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\flask\app.py", line 1947, in full_dispatch_request rv = self.preprocess_request() File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\flask\app.py", line 2241, in preprocess_request rv = func() File "C:\Python37\kodovi\Projects\microblog\app\routes.py", line 12, in before_request if current_user.is_authenticated: File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\werkzeug\local.py", line 348, in __getattr__ return getattr(self._get_current_object(), name) File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\werkzeug\local.py", line 307, in _get_current_object return self.__local() File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\flask_login\utils.py", line 26, in <lambda> current_user = LocalProxy(lambda: _get_user()) File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\flask_login\utils.py", line 335, in _get_user current_app.login_manager._load_user() File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\flask_login\login_manager.py", line 359, in _load_user return self.reload_user() File "c:\python37\kodovi\projects\microblog\venv\lib\site-packages\flask_login\login_manager.py", line 317, in reload_user "No user_loader has been installed for this " Exception: No user_loader has been installed for this LoginManager. Refer tohttps://flask-login.readthedocs.io/en/latest/#how-it-works for more info. The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side. You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection: dump() shows all variables in the frame dump(obj) dumps all that's known about the object
Reply
#13
see: https://flask-login.readthedocs.io/en/la...w-it-works
Reply
#14
this is definitely in Flask-Login
some things to check:
is virtualenv activated?
if so, does flask list show Flask-Login package?
if not - while virtualenv is active: pip install Flask-Login

make sure from flask_login import LoginManager is included in __init__.py

and that:
login = LoginManager()
login.login_view = 'auth.login'
login.login_message = _l('Please log in to access this page.')
is also defined before the create_app function in __init__.py
Reply
#15
this 3rd line in your code is not good
Error:
login.login_message = _l('Please log in to access this page.') NameError: name '_l' is not defined
Reply
#16
typo, remove it
Reply
#17
and again I get
Error:
Exception: No user_loader has been installed for this LoginManager. Refer tohttps://flask-login.readthedocs.io/en/latest/#how-it-works for more info.
by the way the syntax from line 3 doesn't look correct to me after removing typo.
I'll try my luck with on facebook group.
Reply
#18
Use request_loader instead and pull whatever data you need to tell them apart from the request data. http://flask-login.readthedocs.io/en/lat...est-loader
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Bug Selenium installed but not installed? NoNameoN 9 4,656 Feb-19-2021, 11:31 AM
Last Post: NoNameoN

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020