"django.db.utils.OperationalError: could not connect to server: Connection refused" during Weblate startup
0 reputation · 13 Apr 2026, 03:30 UTC
A Weblate deployment may fail during initialization when the startup log records "django.db.utils.OperationalError: could not connect to server: Connection refused". This documented error indicates that the Django application cannot establish a connection to PostgreSQL, yet the log entry alone does not distinguish between a misconfigured connection string, an unresolvable database hostname, or a network policy that blocks the port. In orchestrated deployments, the database service and the Weblate container may start concurrently, introducing uncertainty about whether the failure is a static configuration fault or a transient race condition.
Environment variables can override values defined in configuration files, so the effective database settings are not always apparent from the deployment manifest alone. The interaction between startup ordering and connection retries remains an unresolved point when this error is the only symptom present.
Which configuration source takes precedence when this error appears, and does Weblate provide a built-in mechanism to delay application startup until the database is ready, or must that behavior be handled externally?