Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/app-generator/sample-flask-auth-session
Flask User Authentication - Open-source Sample | AppSeed
https://github.com/app-generator/sample-flask-auth-session
appseed-sample flask-sample
Last synced: 20 days ago
JSON representation
Flask User Authentication - Open-source Sample | AppSeed
- Host: GitHub
- URL: https://github.com/app-generator/sample-flask-auth-session
- Owner: app-generator
- License: other
- Created: 2021-09-27T14:08:25.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-25T15:56:27.000Z (about 2 years ago)
- Last Synced: 2024-12-15T21:19:04.091Z (25 days ago)
- Topics: appseed-sample, flask-sample
- Language: HTML
- Homepage: https://blog.appseed.us/flask-user-authentication-free-sample/
- Size: 34.2 KB
- Stars: 20
- Watchers: 3
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# [Flask User Authentication](https://blog.appseed.us/flask-user-authentication-free-sample/)
Open-source Flask project that implements a simple authentication system using `Flask-Login` library - Features:
- ✅ `Up-to-date dependencies`
- ✅ Authentication layer: `Flask-Login`
- ✅ UI: Bootstrap5 via `CDN`
- ✅ Free [Support](https://appseed.us/support/) via `Email` and `Discord`.
## Build from sources
> **Step #1** - Clone sources (this repo)
```bash
$ # Clone the sources
$ git clone https://github.com/app-generator/sample-flask-auth-session.git
$ cd sample-flask-auth-session
```
> **Step #2** - Create a virtual environment
```bash
$ # Virtualenv modules installation (Unix based systems)
$ virtualenv env
$ source env/bin/activate
$
$ # Virtualenv modules installation (Windows based systems)
$ # virtualenv env
$ # .\env\Scripts\activate
```
> **Step #3** - Install dependencies
```bash
$ # Install requirements
$ pip3 install -r requirements.txt
```
> **Step #4** - Set Up Environment
```bash
$ # Set the FLASK_APP environment variable
$ (Unix/Mac) export FLASK_APP=run.py
$ (Windows) set FLASK_APP=run.py
$ (Powershell) $env:FLASK_APP = ".\run.py"
```
> **Step #5** - Create Tables (SQLite persistance)
```bash
$ # Create tables
$ flask shell
$ >>> from app import db
$ >>> db.create_all()
```
> **Step #6** - (optional) Enable DEBUG Environment (local development)
```bash
$ # Set up the DEBUG environment
$ # (Unix/Mac) export FLASK_ENV=development
$ # (Windows) set FLASK_ENV=development
$ # (Powershell) $env:FLASK_ENV = "development"
```
> **Step #7** - Start the project
```bash
$ # Run the application
$ # --host=0.0.0.0 - expose the app on all network interfaces (default 127.0.0.1)
$ # --port=5000 - specify the app port (default 5000)
$ flask run --host=0.0.0.0 --port=5000
$
$ # Access the app in browser: http://127.0.0.1:5000/
```
![Flask User Authentication - Free sample provided by AppSeed.](https://user-images.githubusercontent.com/51070104/134959525-3ad0c71c-27e4-45f7-b7b9-53b76f3884bf.png)
## Code-base structure
The project has a super simple structure, represented as bellow:
```bash
< PROJECT ROOT >
|
|-- app/
| |-- static/
| | |-- # CSS files, Javascripts files
| |
| |-- templates/
| | |
| | |-- index.html # Index File
| | |-- login.html # Login Page
| | |-- register.html # Registration Page
| |
| |
| config.py # Provides APP Configuration
| forms.py # Defines Forms (login, register)
| models.py # Defines app models
| views.py # Application Routes
|
|-- requirements.txt
|-- run.py
|
|-- ************************************************************************
```
## Resources
- Free [Admin Dashboards](https://appseed.us/admin-dashboards/open-source) - index provided by AppSeed
- [Flask Social Login](https://blog.appseed.us/flask-social-login-with-github/) - blog article (includes a free sample)
---
[Flask User Authentication](https://blog.appseed.us/flask-user-authentication-free-sample/) - Free sample provided by **AppSeed**.