Usage
Pre-requisites
Before getting started, please ensure that you have the following dependencies installed on your system:
- Docker: Installation guide
- Docker Compose: Installation guide
- Poetry: Installation guide
Getting Started
To set up and run the app, please follow these steps:
-
Move to the directory where
pyproject.toml
is located: -
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
- Activate the virtual environment:
shell
poetry shell
- 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
- Build and start the Docker containers:
shell
make build
-
Open your browser and go to
http://localhost:8000
to see the app running. -
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
-
To check the documentation of the API, go to
http://localhost:8000/docs
. -
To check the database you can use hosted
pgAdmin
tool, just go tohttp://localhost:5050
and login with the credentials from.env
file: - Email:
$PGADMIN_EMAIL
- Password:
$PGADMIN_PASSWORD