Skip to content

Usage

Pre-requisites

Before getting started, please ensure that you have the following dependencies installed on your system:

Getting Started

To set up and run the app, please follow these steps:

  1. Move to the directory where pyproject.toml is located:

  2. Install the dependencies:

shell poetry install

If you don't want to install the dev packages, you can use the following command instead: shell poetry install --without dev

  1. Activate the virtual environment:

shell poetry shell

  1. All necessary commands to start with the project can be found in Makefile. To see all available commands, run the following command:

shell make help

  1. Build and start the Docker containers:

shell make build

  1. Open your browser and go to http://localhost:8000 to see the app running.

  2. Since there is only one SQLAlchemy model, you can create a new migration file by running the following command:

shell chmod -R +x scripts/ ./scripts/autogenerate.sh "user_init" or shell make autogenerate msg="user_init"

This will create a new migration file in demo-api/alembic/versions/.

Since the app service inside docker-compose.yaml will automatically run the alembic upgrade head command whenever it starts, in order to apply the new migration, you just need to stop the containers and start them again. CTRL+C to stop the containers and then run the following command to start them again: shell make up

  1. To check the documentation of the API, go to http://localhost:8000/docs.

  2. To check the database you can use hosted pgAdmin tool, just go to http://localhost:5050 and login with the credentials from .env file:

  3. Email: $PGADMIN_EMAIL
  4. Password: $PGADMIN_PASSWORD