Docker network with Django, Nginx, Postgres

I have a Docker network with Django, Nginx, and Postgres. I’m trying to set an old project up on docker for future development as a way to get more familiar with docker. I’ve been able to figure everything out until I switched from SQLite to MySQL/Postgres. MySQL was giving me errors about python’s sha_2_connection import and even when I changed the my.cnf to use native mysql encryption it persisted. Postgres is working but when I try to run the migrate command Django cannot find the database.

In my compose file I specify the port 3306 but in the console postgres is running on 5432, the default. I’ve tried setting the django settings for the database host to db (the docker service name), localhost, 0.0.0.0, 127.0.0.1, etc. The error will say “Is the database listening on 0.0.0.0 port 5432?” And docker container ls shows postgres on 0.0.0.0:5432->5432

I’m very confused by this. Any assistance would be appreciated as I’d like to begin using docker for more things.

Here is my compose file: https://gist.github.com/shenkan/e41f589b50e698631bbacc0f756fac2b

Looks like I needed to set the HOST in the Django config to “db”