In one folder I have 3 files: base.py, Dockerfile and docker-compose.yml.
base.py:
import psycopg2 conn = psycopg2.connect(\"dbname=\'b
Changing the host from "db" to "postgres" worked for me.
Also use postgres defaults for username and password which is
username: postgres password: