Django - (OperationalError) FATAL: Ident authentication failed for user "username"

Your pg_hba.conf is configured to use 'ident' authentication for connections from localhost (127.0.0.1). You need it to be changed to md5 for your database and user combination.


@Craig is right, have to update the authentication method of the database user in the file pg_hba.conf, here what I've done:

sudo nano /var/lib/pgsql/data/pg_hba.conf

Go to the bottom of the file, then change the method from ident to md5 on the IPv4 and IPv6 rows:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5  # <- here
# IPv6 local connections:
host    all             all             ::1/128                 md5  # <- and here
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            ident
#host    replication     postgres        ::1/128                 ident

Happy Coding :)