This application uses Flask and PostgreSQL, Swagger for api documentation using Flasgger and Pytest for testing.
- Game
- User
- Review
- Category
git clone https://github.com/LeoJosephson/flask-project.git
Make sure you have python installed
Use the package manager pip to install the additional packages
pip install -r requirements.txt
create a file (.env) in the root of the project with the following variables:
Variable name | Description | Example |
---|---|---|
FLASK_APP | flask application | project/app.py |
POSTGRES_USER | Postgres username | "postgres" |
POSTGRES_PASSWORD | Postgres password | "password" |
POSTGRES_PORT | Postgres port | "5433" |
HOST | host | "localhost" |
FLASK_APP variable must be equal to project/app.py
make sure you are in the project folder
flask shell
to start flask shell
from extensions.database import db
from models.category import Category
from models.game import Game
from models.user import User
from models.review import Review
db.create_all()
flask run
docker compose up
Need to be in the project folder
python -m pytest
python -m pytest --cov-report html --cov
The html coverage is located at htmlcov/index.html
The default endpoint is apidocs
Example: http://127.0.0.1:5000/apidocs/