PostgreSQL: error with pg_hba.conf

postgresql

I am trying to connect with Django to a PostgreSQL database I set up on a remote machine.

I get the following error:

django.db.utils.OperationalError: FATAL:  no pg_hba.conf entry for host "::1", user "user1", database "ttio", SSL off

Here is my pg_hba.conf file:

 local samerole all        md5
 host samerole all  127.0.0.200   255.255.255.255   pam     pamservice=postgresql_cpses
 host samerole all  127.0.0.1   255.255.255.255   md5
 local all postgres        md5
 host all postgres  127.0.0.1   255.255.255.255   md5

I am running the database(Postgres 8.4) and my OS flavor is Centos.In my Ubuntu 15.04 local machine it works perfectly.
Any solutions for this ?

Best Answer

You obviously do not have connection profile for user "user1" against database "ttio" on the machine. The only remote access that your pg_hba.conf currently specifies is for any user to the database with the same name as the user from address 127.0.0.200.

You need an entry like:

host ttio user1 <ip_address> <netmask>

The <ip_address> <netmask> combination is specific to your network configuration and refers to the IP address of the client.