FastAPI + SQL Alchemy practice

Installation

  1. clone this repo
  2. create virtual environtment
# for windows

$ python -m virtualenv venv

$ venv\Script\activate

# for linux / macOS

$ python3 -m virtualenv venv

source venv/bin/activate
  1. install all dependencies
(venv) $ pip install -r requirements.txt
  1. add .env file, look at .env.example file
  2. run migration with alembic

Initialize alembic

(venv) $ alembic init alembic

Make migrations

(venv) $ alembic revision -m "First migration"

Migrate

(venv) $ alembic upgrade head
  1. run the server
(venv) $ uvicorn main:app --reload