Almost every Web Application needs to manage its user information. Ranging from user registration, confirmation or handling logins, these involve a complex practice that if implemented improperly can have serious consequences. It is always better to use built and tested tools for account management than build on your own. Flask-user is one of such extension available for handling user accounts in the flask.
Installation and setup
You can add
Flask-User==0.6.21 to your
requirements.txt or just type
pip install Flask-User==0.6.21 to install flask. That installs flask user with all the necessary dependencies needed.
One more thing you need to do is to download the templates from the flask user Github repository, to add customizations to your login page. To do that you need to create a template folder in your project folder which to store all the HTML files that you use for your web application.
Then download the source form the Github Repository link above and extract the zip file and move to the flask_user folder then to templates and copy all its contents to your project folder.
The easy tutorial
While I was researching for the project, I found a series of simple tutorial videos of Anthony from Pretty Printed. So Instead of reinventing the wheel. I link you to tutorials on Flask user.
- Part 1: Introduction to Flask-User
- Part 2: Flask-User: Enabling Emails
- Part 3: Flask-User: Configuration And Templates
Note: The Part numbering is done by me for you to follow the flow quickly.
If you get stuck somewhere, you can always refer to the documentation. Many thanks to Anthony of Pretty Printed for detailed and well-explained videos.
Reference and further reading: