I\'ve run into a weird situation while trying to use PostgreSQL and Psycopg2. For some reason, every time I attempt to connect to the postgre database via python, I get the foll
I recently got into this same issue and I found the solution for this problem.
System:
python
, django
, psycopg2
and postgres client 9.6.1
(postgresql-9.6.1.tar.gz
)), for instance ip address 10.0.0.1
(a private address).aws_rds_host_name
" or any database IP address.Error:
django.db.utils.OperationalError: FATAL: no pg_hba.conf entry for host
"10.0.0.1", user "your_user", database "your_db", SSL off
Solution:
While installing the postgres client 9.6.1
source package in application server 10.0.0.1
, we have to pass an argument "--with-openssl
". I suggest to remove the existing the postgres client
and install with below steps.
postgres client source package 9.6.1
(postgresql-9.6.1.tar.gz
)postgresql-9.6.1.tar.gz
../configure --prefix="your_preferred_postgres_path_if_needed" --with-openssl (this '--with-openssl'
argument is important to get rid of that error)psycopg2
.I hope this solution helps someone.