why my django app is not connected to a postgresql in a docker environment?

This ports config section:

  - '5433:5432'

Exposes 5432 container port to 5433 host port. However within the docker network the db is still accessible on the 5432 port, so you need to change your .env file to use 5432 port.

If you don’t need other apps to access db from the host you may omit this ports section at all (you’ll still be able to connect to it using e.g. docker-compose exec)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top