sample backend using pyfastapi, sqlalchemy, and alembic
- python 3.12
- poetry
- sqlite
- install dependencies
poetry install
- copy
.env.example
to.env
and change the values if needed - run the app
poetry run python run.py
- call the api endpoint
curl http://localhost:5000/persons
- open
http://localhost:5000/docs
to view then openapi docs
- build the image
podman build -t pyfastapi .
- run the image
podman run -p 5000:5000 pyfastapi
note: you can use docker
instead of podman
as it is a drop in replacement
- run
alembic upgrade head
- sql schema and the data should be on
./sql_app.db
- refer to
alembic.ini
to change other configuration, it uses .env for the DB url
- make sure main dependencies are installed
- run
poetry install
- run
pytest
, take note that it uses.env.test
for configuration