I’m seeing a sporadic issue with my Django 4.2 app (ifbt.farm) hosted at Digital Ocean. The application connects to a Digital Ocean database cluster. I’ve never had an issue with GET requests, but sometimes when I try to POST an update to the database, I see a 500 error and the gunicorn log shows “connection to server at “localhost” (::1), port 5432 failed: Connection refused”. But Django should never try to connect to postgresql on localhost 5432 because I only have one database configured, and it’s on a different host and port.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'ifbt',
'HOST': '[db-postgresql-sfo3-41894-do-user-14116213-0.b.db.ondigitalocean.com](https://db-postgresql-sfo3-41894-do-user-14116213-0.b.db.ondigitalocean.com)',
'PORT': '25060',
'USER': '*************',
'PASSWORD': '**************',
}
}
At one time, I did have postgresql installed on this node, but have disabled the local postgresql service and uninstalled/purged postgresql, postgresql-contrib, etc… I doubt if this is a Django issue, but just wondered if anyone else has run across anything like it.