Python Forum
Flask: No user_loader has been installed for this LoginManager - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Flask: No user_loader has been installed for this LoginManager (/thread-22934.html)

Pages: 1 2


Flask: No user_loader has been installed for this LoginManager - Truman - Dec-03-2019

I'm following this tutorial and got this exception:
Error:
Exception: No user_loader has been installed for this LoginManager
Any idea how to install it? I wasn't able to find solution.


RE: Flask: No user_loader has been installed for this LoginManager - Larz60+ - Dec-04-2019

you need
pip install Flask-Login



RE: Flask: No user_loader has been installed for this LoginManager - Truman - Dec-04-2019

Output:
(venv) C:\Python37\kodovi\Projects\microblog>pip install Flask-login Requirement already satisfied: Flask-login in c:\python37\kodovi\projects\microblog\venv\lib\site-packages (0.4.1) Requirement already satisfied: Flask in c:\python37\kodovi\projects\microblog\venv\lib\site-packages (from Flask-login) (1.1.1) Requirement already satisfied: itsdangerous>=0.24 in c:\python37\kodovi\projects\microblog\venv\lib\site-packages (from Flask->Flask-login) (1.1.0) Requirement already satisfied: click>=5.1 in c:\python37\kodovi\projects\microblog\venv\lib\site-packages (from Flask->Flask-login) (7.0) Requirement already satisfied: Werkzeug>=0.15 in c:\python37\kodovi\projects\microblog\venv\lib\site-packages (from Flask->Flask-login) (0.16.0) Requirement already satisfied: Jinja2>=2.10.1 in c:\python37\kodovi\projects\microblog\venv\lib\site-packages (from Flask->Flask-login) (2.10.3) Requirement already satisfied: MarkupSafe>=0.23 in c:\python37\kodovi\projects\microblog\venv\lib\site-packages (from Jinja2>=2.10.1->Flask->Flask-login) (1.1.1)
there must be something else. For example, check this stackoverflow solution ( not working on my end ).


RE: Flask: No user_loader has been installed for this LoginManager - Larz60+ - Dec-04-2019

I took the grinberg mega tutorial (although it's the new one), and had absolutly no problem (on Linux Mint 19.1) with the login process.
Have you tried copying his code and attempting to run as delivered?
It would also be helpful to let us know which chapter, and portion of that chapter that you are working on.


RE: Flask: No user_loader has been installed for this LoginManager - Truman - Dec-04-2019

As the link gives, I'm on chapter 7: Error Handling. But actually, from chapter 6 I had this problem, it's only that in chapter 7 we learn how to turn on debug mode that discloses this error.


RE: Flask: No user_loader has been installed for this LoginManager - Larz60+ - Dec-05-2019

So, the error may have been there for a while.
Try this, (if you don't have git installed, you will have to install it: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git )
this is seat of the pants, so may need some adjustment, and you're on windows and I on Linux
  • open a terminal (or 'command window' if on windows)
  • change to directory where you want to create new microblog (obviously can't already be a microblog there)
  • type: git clone https://github.com/miguelgrinberg/microblog
  • cd microblog
  • type: python -m venv venv
  • Create a requirements.txt file from your current tutorial environment:
    • (activate venv on old tutorial)
    • type pip freeze > requirements.txt
    • type: deactivate
    • move requirements.txt to new microblog directory
  • activate new virtual environment
  • upgrade pip: pip install --upgrade pip
  • load packages: pip install -r requirements.txt
  • get chapter 7: git checkout v.07
  • if you get error: Please commit your changes or stash them before you switch branches.
    then type: git stash and then git checkout v.07
  • Try running new flask
if this works, your code should be good through chapter 7 if you want chapter 6 instead, use git checkout v.06


RE: Flask: No user_loader has been installed for this LoginManager - Truman - Dec-05-2019

I get this:
Error:
error: pathspec 'v.07' did not match any file(s) known to git
if you get error: Please commit your changes or stash them before you switch branches.
I have no idea what this means.


RE: Flask: No user_loader has been installed for this LoginManager - Larz60+ - Dec-06-2019

are you in the microblog directory?


RE: Flask: No user_loader has been installed for this LoginManager - LeanbridgeTech - Dec-06-2019

Use request_loader instead and pull whatever data you need to tell them apart from the request data. http://flask-login.readthedocs.io/en/latest/#custom-login-using-request-loader


RE: Flask: No user_loader has been installed for this LoginManager - Truman - Dec-07-2019

(Dec-06-2019, 01:14 AM)Larz60+ Wrote: are you in the microblog directory?

I was in new microblog directory. Should I try again from the first step?