django2+ channel + celery + websocket + ASGI服务开发及配置

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

https://wyx6.top/django-vue%E5%9F%BA%E4%BA%8Ewebsocket%E5%88%9B%E9%80%A0%E5%AE%9E%E6%97%B6ECharts%E8%82%A1%E7%A5%A8%E5%9B%BE/

6. js unicode编码转中文参考

var str = "\u6211\u662Funicode\u7F16\u7801";
1. eval解析或new Function("'+ str +'")()

str = eval("'" + str + "'"); // "我是unicode编码" 

2. unescape 解析

str = unescape(str.replace(/\u/g, "%u")); // "我是unicode编码"

7. docker部署django项目参考

https://ancientone.cf/posts/5cd8a7d.html

你可能感兴趣的:(django2+ channel + celery + websocket + ASGI服务开发及配置)