A RESTful API service template built with fastapi. Use sqlalchemy to query and postgreSQL as database storage.
| Name | Version |
|---|---|
| Python | 3.8 |
| pipenv(Python module) | 2018.11.26 or up |
- Initialize environment variable
cp sample.env .env
- Initialize Python environment
make init
- Enter the environment and start developing
pipenv shell
- Start related components of API service
make service_up
- Start development API service
cd api/
uvicorn app:APP
The server will run at http://127.0.0.1:8000
- (Optional)Stop related components of API service
make service_down
This project uses black and isort for formatting
make reformat
This project uses pylint and flake8 for linting
make lint
This project uses pytest and its extension(pytest-cov) for testing
| Name | Version |
|---|---|
| Docker | 19.03.6 |
| docker-compose | 1.17.1 |
docker-compose build
This will build the image with tag fastapi-sqlalchemy:latest
The service is deployed with docker-compose.
- Start containers
docker-compose up
- Darkborderman/Divik([email protected])