与 'ws:url' 的 WebSocket 连接失败:WebSocket 在建立连接之前关闭

WebSocket connection to 'ws:url' failed: WebSocket is closed before the connection is established

我是 Django Channels 的新手,当我学习一些教程时,我遇到了这个项目 Channels Examples。当我 运行 这个项目在我的系统出现以下错误。

127.0.0.1:56653 - - [20/Feb/2018:17:18:37] "GET /new/" 302 -
127.0.0.1:56653 - - [20/Feb/2018:17:18:38] "GET /royal-dawn-8676/" 200 1865
127.0.0.1:56653 - - [20/Feb/2018:17:18:38] "GET /static/chat.js" 304 -
127.0.0.1:56669 - - [20/Feb/2018:17:18:38] "WSCONNECTING /chat/royal-dawn-8676/" - -
127.0.0.1:56669 - - [20/Feb/2018:17:18:40] "WSDISCONNECT /chat/royal-dawn-8676/" - -
127.0.0.1:56677 - - [20/Feb/2018:17:18:41] "WSCONNECTING /chat/royal-dawn-8676/" - -
127.0.0.1:56677 - - [20/Feb/2018:17:18:43] "WSDISCONNECT /chat/royal-dawn-8676/" - -
127.0.0.1:56680 - - [20/Feb/2018:17:18:45] "WSCONNECTING /chat/royal-dawn-8676/" - -
127.0.0.1:56680 - - [20/Feb/2018:17:18:47] "WSDISCONNECT /chat/royal-dawn-8676/" - -

注意:我的Django版本-1.11.8, 频道版本 1.1.6

我遇到了同样的问题。添加这行代码。关于 chat/consumers.py 关于 ws_connect 函数

def ws_connect(message): message.reply_channel.send({"accept": True}) ...