Hi!

I shall assume that PostgreSQL is listening on port 5432. "Connection timed out" means that the client (Django/psycopg2 in this case) is not getting any response—as if the PostgreSQL server machine did not exist. ("Connection refused", on the other hand, means that the PostgreSQL server machine replied that connection on port 5432 is not possible, because there is no process listening on that port.)

If Django/psycopg2 have the correct domain name or IP address for the PostgreSQL server, and the correct port, the most common explanation for "Connection timed out" is that a firewall (typically on the PostgreSQL server) is filtering that traffic. Is your PostgreSQL server on a different machine than Django?

Regards,

Antonis


On 17/04/2022 17.34, Disha Patel wrote:

Hi,
I am facing below connection timeout error while using Postgres as database for my Django application.

"psycopg2.operationalerror: could not connect to server: connection timed out:

Solutions tried:
1. increased timeout at server end.
2. added conn_max_age in the settings and tried multiple values ( eg. None, 60,120)

It is a random error but occurs very frequently.
Kindly share if anyone aware about the reason for this issue and any solutions for the same.


--
You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b0c59297-5125-46f5-843f-55c0c00eb4acn%40googlegroups.com <https://groups.google.com/d/msgid/django-users/b0c59297-5125-46f5-843f-55c0c00eb4acn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/93d90c47-298b-c2bc-6cc8-d4703583e298%40antonischristofides.com.

Reply via email to