Questions tagged [daphne]

Daphne is a HTTP, HTTP2 and WebSocket protocol server for ASGI, and developed to power Django Channels.

259 questions
3
votes
1 answer

Uvicorn not closing connection when directly closing connection before accepting connection

I am using Django Channels with uvicorn and I have following type of code: async def connect(self): """Accept connect if user has been provided by middleware""" self.user = self.scope.get('user') if self.user: await…
hardik24
  • 1,008
  • 1
  • 11
  • 34
3
votes
1 answer

After Installing Channels Daphne throws 500 Internal Server Error

I am trying out django channels 2.x. After installing and configuring channels. When I execute the runserver command. I get the following error Traceback (most recent call last): File …
Subbu
  • 588
  • 1
  • 7
  • 18
3
votes
1 answer

Nginx with Daphne gives 502 Bad Gateway

I decided to replace uwsgi with daphne since I was having issues with Django Channels and uwsgi. After following this tutorial. I configured my nginx this way in sites-enabled. Most of the other examples I have come across are not using daphne so I…
MistyD
  • 16,373
  • 40
  • 138
  • 240
3
votes
0 answers

502 Bad Gateway during WebSocket handshake

my app uses: django-channels nginx daphne (Django Channels HTTP/WebSocket server) In my frontend html file, there are a few javascript lines like this: socket = new WebSocket("ws://" + window.location.host); socket.onmessage = function(e)…
ThinkTeamwork
  • 544
  • 5
  • 19
3
votes
0 answers

Nginx+daphne WebSocket connect doesn't receive

I use nginx as reverse proxy for daphne to use django channels. Here's my nginx.conf server { listen 80; server_name ; location / { proxy_pass http://0.0.0.0:8001; …
3
votes
1 answer

Why do I need reverse proxy with daphne?

I red a lot of tutorials about using django channels with daphne and everyone use nginx(or apache, does not matter) as a reverse proxy? Why do I need a reverse proxy? Can't I use just daphne for production?
3
votes
0 answers

Why does Daphne fail when run through supervisor, but works when run on command line?

I am trying to use supervisor to manage a Daphne server and a few workers for a Django application in AWS. I have been following this tutorial. My supervisord.conf looks like this: ; supervisor config…
Michael
  • 61
  • 1
  • 6
3
votes
4 answers

Is it possible to start Daphne in a python script without using an OS call

Is it possible to run a daphne process or even just Django channels from a python script? The recommended way to do it, is to run daphne -b 0.0.0.0 -p 8001 django_project.asgi:channel_layer I was wondering if I could bind that to a variable and run…
cjds
  • 8,268
  • 10
  • 49
  • 84
3
votes
1 answer

Django Channels Worker not responding to websocket.connect

I'm having a problem with django channels. Daphne accepts WebSocket CONNECT requests properly, but then the workers doesn't respond to the request with the supplied method in consumers.py. The thing is this happens only most of the time. Sometimes…
akiortagem
  • 135
  • 3
  • 16
2
votes
0 answers

module not found 'core' error when deploying django with django channels on heroku

I have been trying to deploy my application on heroku with django channels and I always get the following error 2022-05-26T20:09:58.137436+00:00 app[web.1]: ModuleNotFoundError: No module named 'core' I have seen previous questions such as…
Androxus
  • 31
  • 2
2
votes
1 answer

django-channels: page not found, connection failed

I am trying to set up django-channels. I did everything according to the instructions, but when I try to connect, I get a 404 error - page not found. I make a request from the localhost to the dev server. config/base.py INSTALLED_APPS = [ …
Dima
  • 112
  • 12
2
votes
1 answer

Daphne + Channel v3 Deployment, RuntimeError: no running event loop

When I run systemctl start daphne I get the following error Traceback (most recent call last): File "/srv/www/portal/bin/daphne", line 8, in sys.exit(CommandLineInterface.entrypoint()) File…
James Lin
  • 25,028
  • 36
  • 133
  • 233
2
votes
2 answers

Getting Error 404 instead of json when trying to use daphne server and pagekite

so I wrote a backend for my website with Python and FastAPI and now want to run it on my computer or phone. To run the python server I decided to use daphne, to make it reachable from a domain name, I've decided to use pagekite. However, when I go…
Petr L.
  • 414
  • 5
  • 13
2
votes
0 answers

Django Channels / Daphne Internal Server Error: 'module' object is not callable

I'm trying to install a production server for Django Channels application I've been running locally with success. However, when starting Daphne and reaching to the application via browser, I get an Internal Server Error from Daphne. Console output…
Uitto
  • 31
  • 3
2
votes
0 answers

Issue connecting to secure websocket using Django/Nginx/Daphne

Having an issue using secure websocket (wss) with django, Nginx, Gunicorn, and daphne. My site is hosted through cloudflare which provides the SSL/TLS certificate. I'm using a linux socket in /run/daphne/daphne.sock, where I gave the user 'ubuntu'…
sbriley
  • 36
  • 5