A simple demo that shows one approach at how to build and test apps that use async features with Postgres database storage.
- Python >= 3.8
- PostgreSQL, preferably using any of the official Postgres Docker images
- Docker
- aiopg >= 1.0.0
- SQLAlchemy == 1.3.17
- pytest and pytest-asyncio
Please see requirements.txt
for full list of dependencies.
- Clone this repo
- Create and activate a virtual environment
- Install the dependencies:
$ pip install -r requirements.txt
- Create a
.env
file in the project root and provide values to environment variables (see 'Environment Variables' section below) - Run Postgres docker image:
$ docker run --rm -p 5432:5432 --env-file .env --name db postgres
- Run the test suite:
$ pytest
Please create a .env
file that defines values for the following environment variables:
POSTGRES_USER
(name of Postgres user)POSTGRES_PASSWORD
(Postgres password)POSTGRES_DB
(database name)DB_HOST
(host where Postgres is running, usuallylocalhost
)
This project is available under the MIT License.