PostGIS Connection Timeouts: Can't Connect Django Service Despite Correct Variables

arogoclin
HOBBY

3 months ago

I'm deploying a Django application with PostGIS on Railway, but consistently encounter connection timeouts when trying to connect my Django service to the PostGIS database. The services appear properly linked in the dashboard, and all required variables (PGHOST, PGPORT, DATABASE_URL, etc.) are set. However, both public (crossover.proxy.rlwy.net) and private (postgis.railway.internal) connections fail with timeout errors.

(crowdmap) C:\Users\AROGO\django_projects\Church_Attendance\HealthMapper>railway run psql "$DATABASE_URL" -c "\conninfo"

←[1;32mNew version available:←[0m v←[33m4.3.0←[0m visit ←[35mhttps://docs.railway.com/guides/cli←[0m for more info

psql: error: connection to server at "crossover.proxy.rlwy.net" (64:ff9b::23d6:abeb), port 5432 failed: Connection timed out (0x0000274C/10060)

Is the server running on that host and accepting TCP/IP connections?

connection to server at "crossover.proxy.rlwy.net" (35.214.171.235), port 5432 failed: Connection timed out (0x0000274C/10060)

Is the server running on that host and accepting TCP/IP connections?

Awaiting User Response

3 Replies

3 months ago

Hello,

You would want to be using the host postgis.railway.internal and the port 5432.

Please make sure you are using that exact combo.

Best,
Brody


Status changed to Awaiting User Response Railway 3 months ago


arogoclin
HOBBY

3 months ago

I have my database in supabase, and I was trying to connect my web app to it, but seemingly, the web service doesn't rreach the host name of my supabase database, here is the error i get:
File "/usr/local/lib/python3.9/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 101, in prepare_database

May 02 16:35:15

with self.cursor() as cursor:

May 02 16:35:15

File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner

May 02 16:35:15

return func(*args, **kwargs)

May 02 16:35:15

File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 330, in cursor

May 02 16:35:15

return self._cursor()

May 02 16:35:15

File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 306, in _cursor

May 02 16:35:15

self.ensure_connection()

May 02 16:35:15

File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner

May 02 16:35:15

return func(*args, **kwargs)

May 02 16:35:15

File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 289, in ensure_connection

May 02 16:35:15

self.connect()

May 02 16:35:15

File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 91, in exit

May 02 16:35:15

raise dj_exc_value.with_traceback(traceback) from exc_value

May 02 16:35:15

File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 289, in ensure_connection

May 02 16:35:15

self.connect()

May 02 16:35:15

File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner

May 02 16:35:15

return func(*args, **kwargs)

May 02 16:35:15

File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 270, in connect

May 02 16:35:15

self.connection = self.get_new_connection(conn_params)

May 02 16:35:15

File "/usr/local/lib/python3.9/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 112, in get_new_connection

May 02 16:35:15

connection = super().get_new_connection(conn_params)

May 02 16:35:15

File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner

May 02 16:35:15

return func(*args, **kwargs)

May 02 16:35:15

File "/usr/local/lib/python3.9/site-packages/django/db/backends/postgresql/base.py", line 275, in get_new_connection

May 02 16:35:15

connection = self.Database.connect(**conn_params)

May 02 16:35:15

File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect

May 02 16:35:15

conn = connect(dsn, connectionfactory=connection_factory, **kwasync)

May 02 16:35:15

django.db.utils.OperationalError: connection to server at "db.tpiagcexddntgxplotbt.supabase.co" (2406:da1a:6b0:f601:beda:85e0:171b:8efd), port 5432 failed: Network is unreachable

May 02 16:35:15

Is the server running on that host and accepting TCP/IP connections?


Status changed to Awaiting Railway Response Railway 3 months ago


3 months ago

You need to use a supabase domain that has support for IPv4 as we do not offer public outbound support for IPv6 networking.


Status changed to Awaiting User Response Railway 3 months ago


PostGIS Connection Timeouts: Can't Connect Django Service Despite Correct Variables - Railway Help Station