My simple python flask application failed to connect to redshift database. Logged error :
psycopg2.OperationalError: could not create SSL context: library has no ciphers FATAL: no pg_hba.conf entry for host "::ffff:0.0.0.0", user "admin", database "redshiftdb", SSL off
But when I the try same connection works well with simple python(simple.py) without flask.
import psycopg2
conn = psycopg2.connect(database="redshiftdb", user = "admin", password = "admin!pwd", host = "remotehost", port = "5439")
print ("Opened database successfully")
but with flask it does not work (init.py).
from flask import Flask
import psycopg2
@app.route("/service")
def service():
conn = psycopg2.connect(database="redshiftdb", user = "admin", password = "admin!pwd", host = "remotehost", port = "5439")
return "Service is running!"
if __name__ == "__main__":
app.run()
- ubuntu v12
- Python version : 3.4
- psycopg2==2.7.5
- psycopg2-binary==2.7.5
- Flask==1.0.2