환경
windows 10 pro
python 3.9.1
pip install channels-redis만 하면 될줄 알았는데 redis server를 설치해야하더라.
그리고 Redis는 공식적으로 window를 지원하지 않는다.
https://github.com/tporadowski/redis/releases
Releases · tporadowski/redis
Native port of Redis for Windows. Redis is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Se...
github.com
여기서 Redis-x64-5.0.10.msi 를 설치했다.
channels layer가 Redis와 잘 통신하는지 확인하기 위해 아래 명령을 쉘에서 실행했다
>>> import channels.layers
>>> channel_layer = channels.layers.get_channel_layer()
>>> from asgiref.sync import async_to_sync
>>> async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})
>>> async_to_sync(channel_layer.receive)('test_channel')
하지만 aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN' 에러를 발생시켰고 출처가 기억이 안나는데 redis 통합설치가 문제였다.
pip install channels-redis==2.4.2
2.4.2 버전을 설치했더니 오류가 사라졌다.
수정) 20210820
AttributeError: type object 'ChatConsumer' has no attribute 'as_asgi'
channel-redis==2.4.2 설치후 이런 에러가 발생했다. channels 와 channel-redis를 모두 최신버전으로 업데이트하고나니 해결되었다.
channels 3.0.4 channels-redis 3.3.0
해결되는줄 알았는데 다시 aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN' 를 발생시킨다.
버전을 너무 올리면 BZPOPMIN, 너무 낮으면 has no attribute 'as_asgi' 인거같다. 중간점이 어딘지 조사중이다.
* channels-redis를 2.4.2로 내리면 channels는 자동으로 2.4.0으로 downgrade되는것같다.
AttributeError: type object 'ChatConsumer' has no attribute 'as_asgi()
'''python from django.urls import re_path from . import consumers websocket_urlpatterns = [ re_path(r'ws/chat/(?P\w+)/$',consumers.ChatConsumer.as_asgi()),] getting error of a...
stackoverflow.com
이 Danish아저씨 말에 따르면 channels 3.0.1에서 as_asgi 가능하다니 channels를 3. 대에서 맞추면서 channels-redis를 조절해보고자한다.
'ERROR' 카테고리의 다른 글
기본 파이썬을 변경하는법 (2.7 to 3) (0) | 2022.04.07 |
---|---|
Package 'python3-pip' has no installation candidate (0) | 2022.03.06 |
SystemCheckError: System check identified some issues: (0) | 2021.05.07 |
CSS 적용 문제 (0) | 2021.05.03 |
Django NoReverseMatch Error (0) | 2021.05.02 |