A Simple Authentication System Project with basic user functionality in Python Flask with SQLAlchemy.
๐ Go to Website
- Create an account
- Log In via username or email
- Social login with Google OAuth
- Log out effortlessly
- Email verification for account activation
- Reset password via secure link
- Update email address with confirmation link
- Google reCAPTCHA support for login and register forms
- Edit profile details and upload a profile image
- Change password anytime after logging in
- Set new theme preferences
- Flask
- Flask-Login
- Flask-SQLAlchemy
- Flask-WTF
- Flask-Mail
- Flask-Migrate
- Flask-Limiter
- Bootstrap-Flask
- Authlib
- Jinja2
- Pytest
For local (without Docker) setup, youโll need:
-
pip (Python package installer)
-
PostgreSQL / SQLite (depending on your DB setup ignore if using docker)
Make sure to also have:
-
A
.envfile with required environment variables (see.env.example) -
Access to required API keys or credentials (e.g., for Flask-mail, OAuth logins, Google re-captcha)
git clone https://github.com/anuraagnagar/flask-user-authentication.gitcd flask-user-authenticationNote: To run this project, you will need to change
.env.examplefile to.envon base directory and set the environment variables.
You can run this project with Docker. For that, you need to have Docker installed and running on your machine.
To run the project with Docker, follow these steps:
docker compose -f docker/docker-compose-local.yml upOn Windows
python -m venv venvvenv\scripts\activateOn MacOS/Linux/Unix
python3 -m venv venvsource venv/bin/activatepip install -r requirements.txtNote: In some cases, the
flask dbcommand might not appear until the application is started withflask runcommand. Make sure to run this command before proceeding with any database migrations.
Initialize the database migration directory.
flask db initRun migrate command.
flask db migrate -m "initial_migration"Upgrade the database for latest migration.
flask db upgradeCreate a Initial Test User for our application.
flask createtestuserOnce the database is set up, you can run the Flask server to start your application.
flask runTo access this application open http://localhost:5000 in your web browser.
The code structure used for selecting a theme is also used to select the language.
To build the messages.pot file and initialize the translations/ directories for the first time for any new language, run these commands once:
pybabel extract -F babel.cfg -o messages.pot .
pybabel init -i messages.pot -d translations/ -l es
Whenever you add new translatable text or update existing ones, update your translation files by running:
pybabel extract -F babel.cfg -o messages.pot .
pybabel update -i messages.pot -d translations/
After translating the items in .po files located in translations/XX/LC_MESSAGES/messages.po, compile the translations into .mo files with:
pybabel compile -d translations/
Contributions are welcome! If you find a bug or want to add a new feature, please open an issue or submit a pull request. For more information checkout CONTRIBUTING.md
By contributing to this project, you agree that your contributions will be licensed under the MIT License.








