I've setup my Django application to use SSL while connecting to the Postgresql database via pgbouncer. I'm using Psycopg2 library.
I've done this before successfully, so I just did the same steps again.
But! After installing certificates to both servers and clients and making the installations, when I tried to run my application, I've got the error:
django.db.utils.OperationalError: server does not support SSL, but SSL was required
When I entered the command
psql --set=sslmode=verify-full -h DBHOST -p DBPORT -U USERNAME DBNAME
I can successfully connect to database by entering my password
But when I write the command like this;
psql "sslmode=verify-full host=DBHOST dbname=DBNAME port=DBPORT user=USERNAME"
or when I entered the code from python shell
import psycopg2
conn = psycopg2.connect(database='DBNAME', user='DBUSER', password='DBPASS', host='DBHOST', port='DBPORT', sslmode='verify-full')
I got the stack trace;
/virtual_environment_path/local/lib/python2.7/site-packages/psycopg2/__init__.pyc in connect(dsn, connection_factory, cursor_factory, **kwargs)
128
129 dsn = _ext.make_dsn(dsn, **kwargs)
--> 130 conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
131 if cursor_factory is not None:
132 conn.cursor_factory = cursor_factory
OperationalError: server does not support SSL, but SSL was required
What may be the problem? I've compared the installated packages between previous installation which is succesful, versions of packages, certificates, file permissions etc. But I'm stuck in this issue.
Thank you very much for your help.