当我尝试使用如下所示的 sslserver
运行 Django 应用程序时,
python manage.py runsslserver
错误:
回溯(traceback):
Validating models...
System check identified no issues (0 silenced).
November 08, 2019 - 11:17:26
Django version 2.0.7, using settings 'dashboard_channels.settings'
Starting development server at https://127.0.0.1:8000/
Using SSL certificate: \lib\site-packages\sslserver\certs\development.crt
Using SSL key: \lib\site-packages\sslserver\certs\development.key
Quit the server with CTRL-BREAK.
[08/Nov/2019 11:18:33] "GET / HTTP/1.1" 200 1299
[08/Nov/2019 11:18:34] "GET / HTTP/1.1" 200 1299
[08/Nov/2019 11:18:35] "GET /static/js/jquery.js HTTP/1.1" 200 270575
Not Found: /ws/home
[08/Nov/2019 11:18:36] "GET /ws/home HTTP/1.1" 404 2134
浏览器控制台:
(index):31 WebSocket connection to 'wss://127.0.0.1:8000/ws/home' failed: Error during WebSocket handshake: Unexpected response code: 404
(index):41 error Event
(index):44 close CloseEvent
代码:
Javascript:
var loc = window.location;
var wsStart = 'ws://';
if (loc.protocol == 'https:') {
wsStart = 'wss://'
}
var endpoint = wsStart + loc.host + '/ws/home';
var socket = new WebSocket(endpoint);
使用python manage.py runserver
命令运行良好,对于http
工作正常,但不适用于https
。
如何解决这个问题?(如何调试以解决此问题?)
是否有其他方法在https
门户上部署WebSockets?
仍然面临此问题。 有人可以帮忙吗?
无论如何,这是为测试目的,最终我需要在Windows服务器机器的Apache2.4上部署它。 我已经设置了https
,但没有设置Web套接字。
http
没有问题。 - shaik moeedCHANNEL_LAYERS
已经配置好,并且在http
上运行得非常好。如何在https
上运行? - shaik moeed