Hi Antonis, 

Yes, the PostgreSQL server is on a difference machine than Django. I have 
noticed that initial connections are successful but it fails in the later 
connections mainly in long running jobs. 

Thanks,
Disha

On Friday, April 22, 2022 at 12:19:27 PM UTC+5:30 Antonis Christofides 
wrote:

> 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...@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/8f413f70-7795-45c5-97ee-ee1278f69a21n%40googlegroups.com.

Reply via email to