I'm using Django created with the template cookie-cutter. When I try to run the project with docker locally it gives me the following error.
FATAL: password authentication failed for user "user"
DETAIL: Role "user" does not exist.
But the role "user" exists. Using the command postgres=# \du
gives me the role "user"
I have a .env
file with the recommended configuration by cookie cutter.
POSTGRES_PASSWORD=password
POSTGRES_USER=user
I tried giving the user a password and granting all privileges of the database to the user but doesn't work.
Usually connection problems are due to:
postgresql.conf
not having the listen_addresses
set correctly or the pg_hba.conf
not having correct values.
It often helps to increase postgresql logging in postgresql.conf
to watch what happens when connecting
log_min_duration_statement = 0 ## logs all statements
You could also try at cmd prompt:
pg_isready -d dbname -U user