Hello,
I've just installed django-channels 2 and followed the installation instructions. I've got this error while trying to connect a websocket to my application:
Browser console:
websocketbridge.js:118 WebSocket connection to 'ws://127.0.0.1:8000/userlocation/' failed: Error during WebSocket handshake: Unexpected response code: 500
Django runserver:
[2018/02/05 18:12:56] WebSocket HANDSHAKING /userlocation/ [127.0.0.1:36137]
[2018/02/05 18:12:57] WebSocket DISCONNECT /userlocation/ [127.0.0.1:36137]
I cannot make the output more verbose (already running with -v 3).
consumers.py
from channels.generic.websocket import JsonWebsocketConsumer
class UserLocationConsumer(JsonWebsocketConsumer):
def receive_json(self, content, **kwargs):
print(content)
routing.py
from django.urls import path
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
from mobile.consumers import UserLocationConsumer
application = ProtocolTypeRouter({
"websocket": AuthMiddlewareStack(
URLRouter([
path('userlocation/', UserLocationConsumer),
]))
,
})
Running on ubuntu 16.04 with python 3.5.2, Django 2.0.2
Am I missing something?