germainlefebvre4 / fastapi-backend-clickhouse-boilerplate

Python FastAPI with Clickhouse boilerplate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python FastAPI with Clickhouse boilerplate

Python FastAPI with Clickhouse boilerplate based on https://github.com/tiangolo/full-stack-fastapi-postgresql.

Getting started

Install required packages:

sudo apt update
sudo apt install python3-pip python3-dev
pip install poetry

Setup the database:

docker compose up -d db

Run the app:

poetry install
poetry run alembic upgrade head
poetry run python app/initial_data.py
poetry run uvicorn app.main:app --port=8080 --reload

Troubleshooting

Some distributions might miss some packages. These are some hints if needed:

# cryptography/cffi
sudo apt install build-essential libssl-dev libffi-dev libpq-dev

Development

Setup workspace

sudo apt update
sudo apt install python3-pip python3-dev
pip install poetry
poetry install

Run locally

This section use docker database called bspauto.

docker compose up -d db
poetry run alembic upgrade head
poetry run python app/initial_data.py
poetry run uvicorn app.main:app --port=8080 --reload

Run tests

This section use docker database called bspauto_test.

docker compose up -d db_test
poetry run pytest -sv app/tests/

About

Python FastAPI with Clickhouse boilerplate

License:GNU General Public License v3.0


Languages

Language:Python 77.5%Language:HTML 20.6%Language:Shell 1.3%Language:Mako 0.7%