1、dwebsocket 

2、等框架都是错误的

3、  django/channels 才是正确姿势 555    

4、 

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"

相关文章:

  • 2021-08-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2020-05-16
  • 2019-08-21
  • 2021-07-04
猜你喜欢
  • 2022-12-23
  • 2018-04-03
  • 2022-02-17
  • 2022-02-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案