django websocket
1、dwebsocket
2、等框架都是错误的
3、
pip install -U channels
完成后,您应该添加channels
到您的 INSTALLED_APPS
设置:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
...
'channels',
)
然后,在以下位置进行默认路由myproject/routing.py
:
from channels.routing import ProtocolTypeRouter
application = ProtocolTypeRouter({
# Empty for now (http->django views is added by default)
})
最后,将您的ASGI_APPLICATION
设置设置为指向该路由对象作为根应用程序:
ASGI_APPLICATION = "myproject.routing.application"