Forums

How can I connect my PythonAnywhere app to an external PostgreSQL database (Neon)?

Hi everyone,

I'm hosting a Django application on PythonAnywhere and I need it to connect to an external PostgreSQL database hosted on Neon.tech.

However, when my app tries to connect, I get this error:

connection to server at "xxxxx.neon.tech", port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections?

After checking the documentation, I understand that PythonAnywhere blocks outgoing connections to external database ports (like 5432) by default.

My question is, If I upgrade to a paid account, will I be able to connect to my Neon PostgreSQL database? And if so, do I need to request support to open outgoing connections to port 5432, or will it work automatically?

Thanks in advance!

If you upgrade, we will no longer be blocking the connection. You do not need to request anything.