Hi Yuval Are you using docker machine ? If so the redis server is on the docker machine's IP not on the localhost so you would need to update the docker host in the CHANNEL_LAYERS portion of settings.py.
You show a unix-like shell like for controlling docker; but the connect failed error looks very windowssy; so I'm not sure that the docker engine (daemon) and the python is running on the TCP stack (or kernel/VM) which you would need for the local host connection to work. Also it might be sensible to ensure the connection is being block by a local firewall if you have one. It looks network/local environment related rather than something redis/docker specific. The error show the TCP connection (which you can test with telnet if you have it install) not be made between python and the redis deamon the most likely reason for that is a local firewall or a more complex environment. -- Roger Gammans <rgamm...@gammascience.co.uk> Gamma Science On Tue, 2019-01-15 at 18:49 +0200, Yuval Bachrach wrote: > I did not configure anything, which is probably the problem..I am > following the tutorial. I just did what the tutorial instructed to > do: So I have installed docker as instructed but haven't configured > anything. The tutorial calls installing docker and does not state any > action to take after installing....) > as I am not familiar with docker, could not tell if there is a need > to configure anything to make django channels work. I still need to > do whatever is required to make the tutorial work.Do I need to learn > basics of docker first, or are there some simple things I can do to > enable the environment and keep going with the channels tutorial? > > On Tue, Jan 15, 2019 at 6:38 PM PASCUAL Eric <eric.pasc...@cstb.fr> > wrote: > > > > > > > > > > > > Hi, > > > > > > > > How is configured your Docker stack exactly ? You should have > > several containers in it, at least one for the Redis server, > > another one for the Django app. > > > > > > > > Do you use docker-compose to run the stack ? If yes, could you > > provide the YAML descriptor of the stack ? > > > > > > > > Best > > > > > > > > Eric > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > From: django-users@googlegroups.com <django-users@googlegroups.com> > > on behalf of Yuval Bachrach <yuval.bachr...@gmail.com> > > > > Sent: Tuesday, January 15, 2019 5:31:18 PM > > > > To: django-users@googlegroups.com > > > > Subject: channnels -- communication with redis > > > > > > > > > > > > I fail to have django channels communication with redis running at > > docker container: I am running the channels tutorial and I get an > > error when just following the tutorial instructions. > > > > > > > > > > > > I am quite new with Django (designed a simple site) and have no > > knowledge on redis nor docker > > > > > > > > > > > > I am trying to lean channels using the tutorial: > > https://channels.readthedocs.io/en/latest/tutorial/ > > > > It uses redis over docker > > > > > > > > At tutorial part 2 there is a test for “channel layer can > > communicate with Redis”. > > > > > > I fails this test. I was looking over the web for solving this > > communication problem with no luck. > > > > As I am not familiar with redis nor docker, I have hard time > > analyzing the reasons for the communication problems. I can see > > that redis is running inside a docker container. > > > > > > > > > > $ docker ps > > > > CONTAINER ID IMAGE COMMAND > > CREATED STATUS PORTS > > > > NAMES > > > > 2bdabc272ec3 redis "docker-entrypoint.s…" > > About an hour ago Up About an hour 0.0.0.0:6379->6379/tcp > > > > quizzical_panini > > > > $ docker inspect quizzical_panini > redisimage.log > > > > (YB: will paste the logfile at the end of this message) > > > > > > > > > > > > > > > > python manage.py shell > > > > 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'}) > > > > Error begins with: > > > > In [4]: async_to_sync(channel_layer.send)('test_channel', > > {'type': 'hello'}) > > > > ------------------------------------------------------------- > > -------------- > > > > ConnectionRefusedError Traceback (most > > recent call last) > > > > <ipython-input-4-80e65666e9e2> in <module> > > > > ----> 1 async_to_sync(channel_layer.send)('test_channel', > > {'type': 'hello'}) > > > > A lot of other details. Ends up with: > > > > 504 # Jump to any except clause below. > > > > --> 505 raise OSError(err, f'Connect call failed > > {address}') > > > > 506 except (BlockingIOError, InterruptedError): > > > > 507 # socket is still registered, the callback will > > be retried later > > > > > > > > > > ConnectionRefusedError: [Errno 10061] Connect call failed > > ('127.0.0.1', 6379) > > > > > > > > > > Some version details: > > > > installing shell command: > > > > $ docker run redis --version > > > > Redis server v=5.0.3 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 > > build=9f27eb593282148b > > > > $ pip install channels_redis > > > > A lot of details: ends up with: > > > > > Successfully installed channels-redis-2.3.3 > > > > $ python --version > > > > Python 3.7.1 > > > > (note that it is a 32 bit python while docker requires 64 bits. I > > assumed it should not be the reason for the problems I do > > experience > > > > > > > > > > > > >>>>>>>> redisimage.log generated by docker inspect as shown above > > <<<<<< > > > > >>>>>>>> It is long. I can’t tell id/what is relevant > > > > [ > > > > { > > > > "Id": > > "2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479", > > > > "Created": "2019-01-15T14:02:36.679774957Z", > > > > "Path": "docker-entrypoint.sh", > > > > "Args": [ > > > > "redis-server" > > > > ], > > > > "State": { > > > > "Status": "running", > > > > "Running": true, > > > > "Paused": false, > > > > "Restarting": false, > > > > "OOMKilled": false, > > > > "Dead": false, > > > > "Pid": 8731, > > > > "ExitCode": 0, > > > > "Error": "", > > > > "StartedAt": "2019-01-15T14:02:37.086931139Z", > > > > "FinishedAt": "0001-01-01T00:00:00Z" > > > > }, > > > > "Image": > > "sha256:5d2989ac9711b6c7a96dfca3110041d6259294f5ccd343491ecfffe3d14 > > 757cc", > > > > "ResolvConfPath": > > "/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089 > > e48b73d55cddcade1d51b70c202aad6479/resolv.conf", > > > > "HostnamePath": > > "/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089 > > e48b73d55cddcade1d51b70c202aad6479/hostname", > > > > "HostsPath": > > "/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089 > > e48b73d55cddcade1d51b70c202aad6479/hosts", > > > > "LogPath": > > "/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089 > > e48b73d55cddcade1d51b70c202aad6479/2bdabc272ec364e6b34a40e253d089e4 > > 8b73d55cddcade1d51b70c202aad6479-json.log", > > > > "Name": "/quizzical_panini", > > > > "RestartCount": 0, > > > > "Driver": "overlay2", > > > > "Platform": "linux", > > > > "MountLabel": "", > > > > "ProcessLabel": "", > > > > "AppArmorProfile": "", > > > > "ExecIDs": null, > > > > "HostConfig": { > > > > "Binds": null, > > > > "ContainerIDFile": "", > > > > "LogConfig": { > > > > "Type": "json-file", > > > > "Config": {} > > > > }, > > > > "NetworkMode": "default", > > > > "PortBindings": { > > > > "6379/tcp": [ > > > > { > > > > "HostIp": "", > > > > "HostPort": "6379" > > > > } > > > > ] > > > > }, > > > > "RestartPolicy": { > > > > "Name": "no", > > > > "MaximumRetryCount": 0 > > > > }, > > > > "AutoRemove": false, > > > > "VolumeDriver": "", > > > > "VolumesFrom": null, > > > > "CapAdd": null, > > > > "CapDrop": null, > > > > "Dns": [], > > > > "DnsOptions": [], > > > > "DnsSearch": [], > > > > "ExtraHosts": null, > > > > "GroupAdd": null, > > > > "IpcMode": "shareable", > > > > "Cgroup": "", > > > > "Links": null, > > > > "OomScoreAdj": 0, > > > > "PidMode": "", > > > > "Privileged": false, > > > > "PublishAllPorts": false, > > > > "ReadonlyRootfs": false, > > > > "SecurityOpt": null, > > > > "UTSMode": "", > > > > "UsernsMode": "", > > > > "ShmSize": 67108864, > > > > "Runtime": "runc", > > > > "ConsoleSize": [ > > > > 30, > > > > 129 > > > > ], > > > > "Isolation": "", > > > > "CpuShares": 0, > > > > "Memory": 0, > > > > "NanoCpus": 0, > > > > "CgroupParent": "", > > > > "BlkioWeight": 0, > > > > "BlkioWeightDevice": [], > > > > "BlkioDeviceReadBps": null, > > > > "BlkioDeviceWriteBps": null, > > > > "BlkioDeviceReadIOps": null, > > > > "BlkioDeviceWriteIOps": null, > > > > "CpuPeriod": 0, > > > > "CpuQuota": 0, > > > > "CpuRealtimePeriod": 0, > > > > "CpuRealtimeRuntime": 0, > > > > "CpusetCpus": "", > > > > "CpusetMems": "", > > > > "Devices": [], > > > > "DeviceCgroupRules": null, > > > > "DiskQuota": 0, > > > > "KernelMemory": 0, > > > > "MemoryReservation": 0, > > > > "MemorySwap": 0, > > > > "MemorySwappiness": null, > > > > "OomKillDisable": false, > > > > "PidsLimit": 0, > > > > "Ulimits": null, > > > > "CpuCount": 0, > > > > "CpuPercent": 0, > > > > "IOMaximumIOps": 0, > > > > "IOMaximumBandwidth": 0, > > > > "MaskedPaths": [ > > > > "/proc/asound", > > > > "/proc/acpi", > > > > "/proc/kcore", > > > > "/proc/keys", > > > > "/proc/latency_stats", > > > > "/proc/timer_list", > > > > "/proc/timer_stats", > > > > "/proc/sched_debug", > > > > "/proc/scsi", > > > > "/sys/firmware" > > > > ], > > > > "ReadonlyPaths": [ > > > > "/proc/bus", > > > > "/proc/fs", > > > > "/proc/irq", > > > > "/proc/sys", > > > > "/proc/sysrq-trigger" > > > > ] > > > > }, > > > > "GraphDriver": { > > > > "Data": { > > > > "LowerDir": > > "/mnt/sda1/var/lib/docker/overlay2/37ad581f24c8ec87f199192366c304f9 > > 52ce27177477746a1d33875a1bd7d7c7- > > init/diff:/mnt/sda1/var/lib/docker/overlay2/c596b32c9a6bf4a75405f32 > > 9338e49ff6167970587db8155633861147b0e6b8a/diff:/mnt/sda1/var/lib/do > > cker/overlay2/6d489fac67dc1b566ea6afa79d458d979294142d7f35edd719081 > > e5559d586c1/diff:/mnt/sda1/var/lib/docker/overlay2/5683f690ef322b4d > > 9c02b1bec18880ddc76d48cfebb4a5454143c919dbd3cee8/diff:/mnt/sda1/var > > /lib/docker/overlay2/d8fd6e07474c264294c0064dda1af0f3c09d7ec35301b8 > > eecacb4ee926a7215b/diff:/mnt/sda1/var/lib/docker/overlay2/cb37f96d8 > > c4d6580faba935057636e928684d73ca58c53136a118918bddbb604/diff:/mnt/s > > da1/var/lib/docker/overlay2/df686dad04ba90e26a4bd48f64a9911f63547b2 > > 05c7289d81fb55300aaacdbb4/diff", > > > > "MergedDir": > > "/mnt/sda1/var/lib/docker/overlay2/37ad581f24c8ec87f199192366c304f9 > > 52ce27177477746a1d33875a1bd7d7c7/merged", > > > > "UpperDir": > > "/mnt/sda1/var/lib/docker/overlay2/37ad581f24c8ec87f199192366c304f9 > > 52ce27177477746a1d33875a1bd7d7c7/diff", > > > > "WorkDir": > > "/mnt/sda1/var/lib/docker/overlay2/37ad581f24c8ec87f199192366c304f9 > > 52ce27177477746a1d33875a1bd7d7c7/work" > > > > }, > > > > "Name": "overlay2" > > > > }, > > > > "Mounts": [ > > > > { > > > > "Type": "volume", > > > > "Name": > > "aae85a2f1e19aedc87713b76fca072247d04632ef0c17c44e7dd44ad4e46219c", > > > > "Source": > > "/mnt/sda1/var/lib/docker/volumes/aae85a2f1e19aedc87713b76fca072247 > > d04632ef0c17c44e7dd44ad4e46219c/_data", > > > > "Destination": "/data", > > > > "Driver": "local", > > > > "Mode": "", > > > > "RW": true, > > > > "Propagation": "" > > > > } > > > > ], > > > > "Config": { > > > > "Hostname": "2bdabc272ec3", > > > > "Domainname": "", > > > > "User": "", > > > > "AttachStdin": false, > > > > "AttachStdout": false, > > > > "AttachStderr": false, > > > > "ExposedPorts": { > > > > "6379/tcp": {} > > > > }, > > > > "Tty": false, > > > > "OpenStdin": false, > > > > "StdinOnce": false, > > > > "Env": [ > > > > > > "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" > > , > > > > "GOSU_VERSION=1.10", > > > > "REDIS_VERSION=5.0.3", > > > > "REDIS_DOWNLOAD_URL=http://download.redis.io/releas > > es/redis-5.0.3.tar.gz", > > > > > > "REDIS_DOWNLOAD_SHA=e290b4ddf817b26254a74d5d564095b11f9cd20d8f16545 > > 9efa53eb63cd93e02" > > > > ], > > > > "Cmd": [ > > > > "redis-server" > > > > ], > > > > "ArgsEscaped": true, > > > > "Image": "redis", > > > > "Volumes": { > > > > "/data": {} > > > > }, > > > > "WorkingDir": "/data", > > > > "Entrypoint": [ > > > > "docker-entrypoint.sh" > > > > ], > > > > "OnBuild": null, > > > > "Labels": {} > > > > }, > > > > "NetworkSettings": { > > > > "Bridge": "", > > > > "SandboxID": > > "d45841da711498d7de27f9d6050c9b5a873e527cb683075277a9fb8621c1dd30", > > > > "HairpinMode": false, > > > > "LinkLocalIPv6Address": "", > > > > "LinkLocalIPv6PrefixLen": 0, > > > > "Ports": { > > > > "6379/tcp": [ > > > > { > > > > "HostIp": "0.0.0.0", > > > > "HostPort": "6379" > > > > } > > > > ] > > > > }, > > > > "SandboxKey": "/var/run/docker/netns/d45841da7114", > > > > "SecondaryIPAddresses": null, > > > > "SecondaryIPv6Addresses": null, > > > > "EndpointID": > > "11ad8c469ed5fc9d9ec1b796fe6853b91a8d61915a66f77763073f5f5535000f", > > > > "Gateway": "172.17.0.1", > > > > "GlobalIPv6Address": "", > > > > "GlobalIPv6PrefixLen": 0, > > > > "IPAddress": "172.17.0.2", > > > > "IPPrefixLen": 16, > > > > "IPv6Gateway": "", > > > > "MacAddress": "02:42:ac:11:00:02", > > > > "Networks": { > > > > "bridge": { > > > > "IPAMConfig": null, > > > > "Links": null, > > > > "Aliases": null, > > > > "NetworkID": > > "354ba15e8a867d659da1a3093bd5ddb71df450b6dbb070edf492d980fdaf2c69", > > > > "EndpointID": > > "11ad8c469ed5fc9d9ec1b796fe6853b91a8d61915a66f77763073f5f5535000f", > > > > "Gateway": "172.17.0.1", > > > > "IPAddress": "172.17.0.2", > > > > "IPPrefixLen": 16, > > > > "IPv6Gateway": "", > > > > "GlobalIPv6Address": "", > > > > "GlobalIPv6PrefixLen": 0, > > > > "MacAddress": "02:42:ac:11:00:02", > > > > "DriverOpts": null > > > > } > > > > } > > > > } > > > > } > > > > ] > > > > > > > > > > > > -- > > > > > > > > > > Yuval B > > > > > > > > > > > > > > > > > > -- > > > > You received this message because you are subscribed to the Google > > Groups "Django users" group. > > > > To unsubscribe from this group and stop receiving emails from it, > > send an email to > > django-users+unsubscr...@googlegroups.com. > > > > To post to this group, send email to > > django-users@googlegroups.com. > > > > Visit this group at https://groups.google.com/group/django-users. > > > > To view this discussion on the web visit > > https://groups.google.com/d/msgid/django-users/CAD16PYQvZFt%3DT9Od9 > > 6LthZD-8cCbfA%2Bf37mXt6icZwVbiiX9Ag%40mail.gmail.com. > > > > For more options, visit https://groups.google.com/d/optout. > > > > > > > > > > > > > > > > -- > > > > You received this message because you are subscribed to the Google > > Groups "Django users" group. > > > > To unsubscribe from this group and stop receiving emails from it, > > send an email to django-users+unsubscr...@googlegroups.com. > > > > To post to this group, send email to django-users@googlegroups.com. > > > > Visit this group at https://groups.google.com/group/django-users. > > > > To view this discussion on the web visit https://groups.google.com/ > > d/msgid/django- > > users/AM0P193MB030846511726FEDB5F8D35DD8C810%40AM0P193MB0308.EURP19 > > 3.PROD.OUTLOOK.COM. > > > > For more options, visit https://groups.google.com/d/optout. > > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1547573530.1554.28.camel%40gammascience.co.uk. For more options, visit https://groups.google.com/d/optout.