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
To set up and run the app, please follow these steps:
-
Move to the directory where
pyproject.tomlis located:cd python-project -
Install the dependencies:
poetry install
If you don't want to install the dev packages, you can use the following command instead:
poetry install --without dev
-
Activate the virtual environment:
poetry shell
-
All necessary commands to start with the project can be found in Makefile. To see all available commands, run the following command:
make help -
Build and start the Docker containers:
make build
-
Open your browser and go to
http://localhost:8000to see the app running. -
Since there is only one SQLAlchemy model, you can create a new migration file by running the following command:
make autogenerate msg="user_init"This will create a new migration file in
python-project/alembic/versions/.Since the
appservice insidedocker-compose.yamlwill automatically run thealembic upgrade headcommand 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:make up
-
To check the documentation of the API, go to
http://localhost:8000/docs. -
To check the database you can use hosted
pgAdmintool, just go tohttp://localhost:5050and login with the credentials from.envfile:- Email:
$PGADMIN_EMAIL - Password:
$PGADMIN_PASSWORD
- Email: