/flask-api-authentication

Example project using Api authentication with Flask

Primary LanguagePython

Flask Api Authentication

Example Project using Api authentication with Flask - Python

Requirements

Python is required to run this project. https://python.org/

Docker-Desktop is required to run docker-composer.yml

Installation

Use the following command on the terminal

pip3 install -r requirements.txt

Libs

Flask Shell

Use to create and make new registrys on the database

Commands

# Enters the flask shell on the terminal
flask shell

# Creates database
db.create_all() #create tables
db.session.commit() # commits changes

# Drop all databases
db.drop_all()
db.session.commit() # commits changes

# Create an instance of the object user with username and password values
user = User(username="admin", password="123")

# See the user info
user
user.username


# Save the object on the database
db.session.add(user)
db.session.commit()

Run Docker for MySql

Requires docker desktop installed.
On bash run:

docker-compose up
# or 
docker-compose up -d #does not lock the terminal

if its already running:

docker-compose up --force-recreate