Example Project using Api authentication with Flask - Python
Python is required to run this project. https://python.org/
Docker-Desktop is required to run docker-composer.yml
Use the following command on the terminal
pip3 install -r requirements.txt
- Flask
- Flask SQL Alchemy
- Flask Login - https://flask-login.readthedocs.io/en/latest/
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()
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