Open app-generator opened 2 years ago
The problem might be environmental:
https://github.com/redis/hiredis/issues/649
We might need to fall back on the dependencies to work with Redis 4.
Thank you so much for the insight, and for pointing out the bug, I'll get that fixed shortly.
The app should work with these dependencies, compatible with Redis 4:
Django==3.2.10
channels==2.4.0
daphne==2.5.0
channels-redis==3.4.0
django-channels==0.7.0
Issue resolved, app now works well with Redis 4 and channels_redis==2.4.x
Hello @DeFidelity
The project cannot be used with Redis 4.
Please fix it and respect the following:
pyc
filesrequirements
and keep the current versions
To move forward from this point, please follow this set up:
$ python manage.py makemigrations
$ python manage.py migrate
$ python manage.py runserver
At this moment, the runserver
exits with error:
AttributeError: type object 'SalesConsumer' has no attribute 'as_asgi'
Full ERROR log
python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
File "D:\work\repo-samples\sample-django-real-time-charts\env\lib\site-packages\channels\management\commands\runserver.py", line 126, in get_application
return StaticFilesWrapper(get_default_application())
File "D:\work\repo-samples\sample-django-real-time-charts\env\lib\site-packages\channels\routing.py", line 29, in get_default_application
module = importlib.import_module(path)
File "C:\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "D:\work\repo-samples\sample-django-real-time-charts\core\asgi.py", line 16, in <module>
from apps.routing import ws_urlpatterns
File "D:\work\repo-samples\sample-django-real-time-charts\apps\routing.py", line 6, in <module>
path('ws/products/',SalesConsumer.as_asgi()),
AttributeError: type object 'SalesConsumer' has no attribute 'as_asgi'
The error as_asgi()
is caused by channels 2.x
auto instalment by channel-redis 2.4.x
and it is due to the dependencies arrangement in the requirements file, channel-redis 2.4.1
needs to be installed beforechannels 3.0.4
and that is fixed now.
Short Log:
Full Log