ERROR deploying with psycopg2

Hello!
I need your help! I want to understand how to deploy app with connection to data base postgressql.
Locally i don’t have problems, it works properly. But on streamlit_cloud i have get mistake:

psycopg2.OperationalError: could not translate host name “host_name” to address: Name or service not known

What should i do to solve it? I have done everything from instruction “Connect Streamlit to PostgreSQL”, put this information into secrets

[postgres]
host = "localhost"
port = 5432
dbname = "xxx"
user = "xxx"
password = "xxx"

May be i should add something else?

Hi @orlova_ev, welcome to the Community! :wave:

You will be unable to host a PostgreSQL server on Streamlit Cloud. You must connect to a remote PostgreSQL database from Streamlit Cloud. I’ll update the docs to emphasize remote.

[EDIT] I’ve updated the docs to emphasize that the guide explains how to connect to remote databases. Users are not able to host MongoDB, MSSQL, PostgreSQL, and MySQL databases on Streamlit Cloud. And when copying your app secrets to Streamlit Cloud, be sure to replace the values of your DB auth creds with those of your remote database.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.