1. 开发参考文档:
Django使用Channels实现WebSocket--上篇
https://blog.ops-coffee.cn/s/hqaprps7w3d-9seegqab2q
Django使用Channels实现WebSocket--下篇
https://blog.ops-coffee.cn/s/r5spytjrl0jjeauye4q_-q
2. django-channels channel_layer redis配置
【三种,默认的\指定库\带密码.】
CHANNEL_LAYERS = { "default": { "BACKEND": "channels_redis.core.RedisChannelLayer", "CONFIG": { "hosts": [('IP', 6379)] }, }, } CHANNEL_LAYERS = { 'default': { 'BACKEND': 'channels_redis.core.RedisChannelLayer', 'CONFIG': {"hosts": ["redis://IP:6379/1"],}, }, } CHANNEL_LAYERS = { "default": { "BACKEND": "channels_redis.core.RedisChannelLayer", "CONFIG": { "hosts": ["redis://:password@IP:6379/0"], "symmetric_encryption_keys": [SECRET_KEY], }, }, }
3. 使用daphne部署django channels websocket项目参考
daphne + 解决wss接口配置启动:
https://www.cnblogs.com/chenjw-note/p/12516097.html
主要参考nginx配置:
https://www.jianshu.com/p/d6394ca19d92
全面配置部署:
https://www.daimajiaoliu.com/daima/479588ed1900408
5. Django + Channels + Celery 实时更新日志
https://www.cnblogs.com/xujunkai/p/12738319.html
6. js unicode编码转中文参考
<pre>var str = "\u6211\u662Funicode\u7F16\u7801";
1. eval解析或new Function("'+ str +'")()</pre><pre>str = eval("'" + str + "'"); // "我是unicode编码" </pre>
2. unescape 解析
<pre>str = unescape(str.replace(/\u/g, "%u")); // "我是unicode编码"</pre>
网友评论