I am running Django 3.2.10 and I am using Django Channels with daphne and gunicorn. I can get my websocket code to run and function without issue but when I go to access any of my django models I hit a snag. I'm doing something like this:
async def receive(self):
modelselected = await database_sync_to_async(self.get_model)()
When I do this which is what the official docs suggest I do, I get the following error from daphne:
daphne | ERROR Exception inside application: could not connect to server: No such file or directory
Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
My Django application works perfectly fine and I connect to the database no problem. I am at a loss to what I'm doing wrong. And my Postgres is running on Port 5432. Any thoughts?