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
--
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.
Since PostgreSQL is listening on a different machine, then it is more or less clear from the error message that the traffic is being filtered. It's strange it works sometimes and other times it isn't working. Does it have a static IP address? Is the PostgreSQL server machine running something like fail2ban?
What I'd do if I had such a problem would be to investigate the
PostgreSQL server machine at the time when the problem is
occurring (e.g. check /var/log/syslog and `iptables -L`).
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8f413f70-7795-45c5-97ee-ee1278f69a21n%40googlegroups.com.