I'm new to channels. I followed the chat tutorial. Everything works with the runserver command also in asyncronous mode.
On the other hand when I use daphne:
(autoACIlab)$ daphne -b 10.9.6.114 -p 8000 autoACIlab.asgi:application -v 2
2019-02-11 14:06:48,352 INFO Starting server at tcp:port=8000:interface=10.9.6.114
2019-02-11 14:06:48,352 INFO HTTP/2 support not enabled (install the http2 and tls Twisted extras)
2019-02-11 14:06:48,352 INFO Configuring endpoint tcp:port=8000:interface=10.9.6.114
2019-02-11 14:06:48,353 INFO HTTPFactory starting on 8000
2019-02-11 14:06:48,353 INFO Starting factory <daphne.http_protocol.HTTPFactory object at 0x7fefb3acdd68>
2019-02-11 14:06:48,354 INFO Listening on TCP address 10.9.6.114:8000
I got this error after the browser request:
2019-02-11 14:08:01,412 ERROR Exception inside application: Cannot import BACKEND 'channels_redis.core.RedisChannelLayer' specified for default
File "/usr/lib/python3.6/site-packages/channels/sessions.py", line 179, in __call__
return await self.inner(receive, self.send)
File "/usr/lib/python3.6/site-packages/channels/middleware.py", line 41, in coroutine_call
await inner_instance(receive, send)
File "/usr/lib/python3.6/site-packages/channels/consumer.py", line 44, in __call__
self.channel_layer = get_channel_layer(self.channel_layer_alias)
File "/usr/lib/python3.6/site-packages/channels/layers.py", line 363, in get_channel_layer
return channel_layers[alias]
File "/usr/lib/python3.6/site-packages/channels/layers.py", line 80, in __getitem__
self.backends[key] = self.make_backend(key)
File "/usr/lib/python3.6/site-packages/channels/layers.py", line 46, in make_backend
return self._make_backend(name, config)
File "/usr/lib/python3.6/site-packages/channels/layers.py", line 73, in _make_backend
% (self.configs[name]["BACKEND"], name)
Cannot import BACKEND 'channels_redis.core.RedisChannelLayer' specified for default
2019-02-11 14:08:01,412 INFO failing WebSocket opening handshake ('Internal server error')
Can anyone send me a clue on that? Do I have to change something in the config files?
Thanks. Regards, Luca
Reinstalled channels-redis with pip everything went fine!
(autoACIlab) $ sudo pip install channels-redis Collecting channels-redis Downloading https://files.pythonhosted.org/packages/b4/cc/9f53db27c65b30c894e44e3f4f3d6cf6394d0417763f702a5c62d7a0f4d7/channels_redis-2.3.3-py2.py3-none-any.whl Collecting msgpack~=0.6.0 (from channels-redis) Downloading https://files.pythonhosted.org/packages/92/7e/ae9e91c1bb8d846efafd1f353476e3fd7309778b582d2fb4cea4cc15b9a2/msgpack-0.6.1-cp36-cp36m-manylinux1_x86_64.whl (248kB) 100% |████████████████████████████████| 256kB 6.2MB/s Requirement already satisfied: asgiref~=2.1 in /usr/lib/python3.6/site-packages (from channels-redis) (2.3.2) Requirement already satisfied: channels~=2.0 in /usr/lib/python3.6/site-packages (from channels-redis) (2.1.7) Collecting aioredis~=1.0 (from channels-redis) Downloading https://files.pythonhosted.org/packages/bc/2f/9ad85f5321f3f8604ae0f9b508f53f5f284fdb18b8095d1770f69e551a5e/aioredis-1.2.0-py3-none-any.whl (63kB) 100% |████████████████████████████████| 71kB 28.2MB/s Requirement already satisfied: async-timeout<4.0,>=2.0 in /usr/lib/python3.6/site-packages (from asgiref~=2.1->channels-redis) (3.0.1) Requirement already satisfied: daphne~=2.2 in /usr/lib/python3.6/site-packages (from channels~=2.0->channels-redis) (2.2.5) Requirement already satisfied: Django>=1.11 in /usr/lib64/python3.6/site-packages (from channels~=2.0->channels-redis) (2.1.5) Collecting hiredis (from aioredis~=1.0->channels-redis) Downloading https://files.pythonhosted.org/packages/65/09/b4688c3997a98c45b7bcb07e98e3a678bce7861d3907f237053d82838a56/hiredis-1.0.0-cp36-cp36m-manylinux1_x86_64.whl (49kB) 100% |████████████████████████████████| 51kB 21.0MB/s Requirement already satisfied: twisted>=18.7 in /usr/lib64/python3.6/site-packages (from daphne~=2.2->channels~=2.0->channels-redis) (18.9.0) Requirement already satisfied: autobahn>=0.18 in /usr/lib/python3.6/site-packages (from daphne~=2.2->channels~=2.0->channels-redis) (19.1.1) Requirement already satisfied: pytz in /usr/lib/python3.6/site-packages (from Django>=1.11->channels~=2.0->channels-redis) (2018.7) Requirement already satisfied: zope.interface>=4.4.2 in /usr/lib64/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels~=2.0->channels-redis) (4.6.0) Requirement already satisfied: constantly>=15.1 in /usr/lib/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels~=2.0->channels-redis) (15.1.0) Requirement already satisfied: incremental>=16.10.1 in /usr/lib/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels~=2.0->channels-redis) (17.5.0) Requirement already satisfied: Automat>=0.3.0 in /usr/lib/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels~=2.0->channels-redis) (0.7.0) Requirement already satisfied: hyperlink>=17.1.1 in /usr/lib/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels~=2.0->channels-redis) (18.0.0) Requirement already satisfied: PyHamcrest>=1.9.0 in /usr/lib/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels~=2.0->channels-redis) (1.9.0) Requirement already satisfied: attrs>=17.4.0 in /usr/lib/python3.6/site-packages (from twisted>=18.7->daphne~=2.2->channels~=2.0->channels-redis) (18.2.0) Requirement already satisfied: six>=1.11.0 in /usr/lib/python3.6/site-packages (from autobahn>=0.18->daphne~=2.2->channels~=2.0->channels-redis) (1.11.0) Requirement already satisfied: txaio>=18.8.1 in /usr/lib/python3.6/site-packages (from autobahn>=0.18->daphne~=2.2->channels~=2.0->channels-redis) (18.8.1) Requirement already satisfied: setuptools in /usr/lib/python3.6/site-packages (from zope.interface>=4.4.2->twisted>=18.7->daphne~=2.2->channels~=2.0->channels-redis) (39.0.1) Requirement already satisfied: idna>=2.5 in /usr/lib/python3.6/site-packages (from hyperlink>=17.1.1->twisted>=18.7->daphne~=2.2->channels~=2.0->channels-redis) (2.8) Installing collected packages: msgpack, hiredis, aioredis, channels-redis Successfully installed aioredis-1.2.0 channels-redis-2.3.3 hiredis-1.0.0 msgpack-0.6.1