最近公司要使用django-channel搭建socket, 文档: https://channels.readthedocs.io/en/stable/introduction.html
文档里面并没有写如果redis有账号和密码的话,怎么配置。
配置方法: https://github.com/django/channels/issues/164#issuecomment-220513297
如下:
CHANNEL_LAYERS = { "default": { "BACKEND": "asgi_redis.RedisChannelLayer", "ROUTING": "widget.routing.channel_routing", "CONFIG": { "hosts": [("redis://username:[email protected]:6379")], }, }, }
当然可以写用户名就可以登陆redis
CHANNEL_LAYERS = { "default": { "BACKEND": "asgi_redis.RedisChannelLayer", "ROUTING": "widget.routing.channel_routing", "CONFIG": { "hosts": [("redis://[email protected]:6379")], }, }, }
标签:layer,账号,redis,django,routing,channel From: https://www.cnblogs.com/dairuiquan/p/17371451.html