Skip to content

profmcdan/k-recon-api

Repository files navigation

Template API Microservice.

Tip
Always read the doc. And remember to update the doc as soon as there is need for it to allow others have a smooth development experience.

Clone Repository

Clone the repo

git clone https://github.com/capitalsagetechnology/py-api-template.git
cd py-api-template

Update the .env from the .env.sample you can copy it

Setup Local Development Environment

Setup your virtual environment using venv and poetry [1].

We use uv package manager for the project, so you may need to install it if needed. UV Guide

uv python install 3.13
uv python list
uv venv
source .venv/bin/activate
uv sync

Enable Lint Checks

pre-commit install
pre-commit run --all-files

Run Code Locally

Ensure that the latest version of docker desktop is installed on your local machine. This will also install docker compose alongside automatically. Follow this link to install docker docker installation.

The run the following command from the root of the application

docker compose up --build

Access the API doc on API Doc

Run Unit Tests

In order to run tests you need to do the following

docker compose run api pytest

Alternatively, you can following the following approach.

docker compose build
docker compose run test

Note also that when you run docker compose up --build the test service also runs once. You can monitor from the logs

Manage Migrations

Whenever you make changes to models, you need to generate migrations locally before pushing your code to the repo. In order to generate migrations, kindly run the following command in another terminal window while your main app is also running

docker compose exec api python manage.py makemigrations
docker compose exec api python manage.py migrate

Access the Deployed Documentation

Visit the deployed links below

The other codebases that are related to this one are

Table 1. Table Contributors
Name Role Email

Daniel Ale

SA

[email protected]

Happy Coding


1. Your local .venv setup may be slightly different depending on your operating system

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages