Error "Is the server running locally and accepting connection"
Hi, I am just trying to setup response app on Local Laptop. Getting these error logs.
[INFO] Waiting for DB
response | [INFO] Migrating database
postgres | 2019-07-22 11:29:09.675 UTC [29] LOG: incomplete startup packet
response | Traceback (most recent call last):
response | File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 217, in ensure_connection
response | self.connect()
response | File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/base.py", line 195, in connect
response | self.connection = self.get_new_connection(conn_params)
response | File "/usr/local/lib/python3.7/site-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
response | connection = Database.connect(**conn_params)
response | File "/usr/local/lib/python3.7/site-packages/psycopg2/__init__.py", line 126, in connect
response | conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
response | psycopg2.OperationalError: could not connect to server: No such file or directory
response | Is the server running locally and accepting
response | connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Hmm, looks like Response can't connect to the Postgres container. Can you post the output of docker-compose logs postgres please?
Hi, Here is the logs :
-> docker-compose logs db
Attaching to postgres
postgres | 2019-07-23 16:35:16.048 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
postgres | 2019-07-23 16:35:16.048 UTC [1] LOG: listening on IPv6 address "::", port 5432
postgres | 2019-07-23 16:35:16.052 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres | 2019-07-23 16:35:16.110 UTC [22] LOG: database system was shut down at 2019-07-22 16:34:49 UTC
postgres | 2019-07-23 16:35:16.152 UTC [1] LOG: database system is ready to accept connections
postgres | 2019-07-23 16:35:19.701 UTC [29] LOG: incomplete startup packet
I thing application trying to connect to the Postgres on local Laptop, but Postgres running on container.
Sorry for the late response to this - @rohitguptarspl did you get this sorted?
I'm getting the same error, too.
I guess, the problem is that current env.example includes production settings file: https://github.com/monzo/response/blob/24cf26497577d058eb8a483f8a5ab7d00d322403/demo/env.example#L6
...which leaves DATABASES not configured properly.
Switching to dev settings fixes this problem. But creates another: all links to incidents point to localhost instead of randomly generated ngrok url.
Just change the example env to point to demo.settings.dev