- Create a virtual environment named 'env' in the root directory of the project
python3 -m venv env
- Activate virtual environment
source env/bin/activate
- Install the required dependencies from requirement.txt file
pip install -r requirement.txt
To run the application in development mode use the following command.
uvicorn main:app --reload
To see list of available endpoints, you can simply open http://localhost:8000/docs.
To setup a postgres database on your device follow the official guide. Once installed follow the following guide.
- Open postgresql and create a postgres database and an user and grant all privilege in that DB.
- Customize .env file information
- Before proceeding further run the migrations using alembic.
alembic upgrade head
- To see current head location use
alembic current
- To downgrade a version use:
alembic downgrade head
- To upgrade a version use
alembic upgrade head
To test your changes to ensure that they function as intended. Include appropriate tests if applicable. To run unit tests locally:
- Install additional dependencies for your test environment listed on
test_requirements.txt
file
pip install -r test_requirements.txt
- Activate test environment
source ./testenv/bin/activate
- To run the test, run
python3 -m pytest
Or, Using coverage
coverage run -m pytest
- Generate coverage report
coverage report -m