Connection refuse

My serve active, but connection refuse. My plan is free.
I use Python
Error:OperationalError: connection to server at “localhost” (::1), port 5432 failed: Connection refused (0x0000274D/10061)
Is the server running on that host and accepting TCP/IP connections?
connection to server at “localhost” (127.0.0.1), port 5432 failed: Connection refused (0x0000274D/10061)
Is the server running on that host and accepting TCP/IP connections?
Code:
connection_string = os.getenv(‘postgres://###:#####@ep-blue-sun-37031258.us-east-2.aws.neon.tech/Teste’)

# Connect to the PostgreSQL database
conn = psycopg2.connect(connection_string)

Line error: 6 conn = psycopg2.connect(connection_string)

Tanks for help :slight_smile: