Docker [Errno 111] Connect call failed ('127.0.0.1', 6379)

前端 未结 4 710
[愿得一人]
[愿得一人] 2021-01-06 09:47

I am trying to follow the tutorial here https://channels.readthedocs.io/en/latest/tutorial/part_2.html and check if channel layer can communicate with Redis. The only differ

4条回答
  •  伪装坚强ぢ
    2021-01-06 10:12

    So I got stuck on this and none of the answers seemed to work for me.

    I found that docker would give the container its own IP address. to find the IP address in the command line I used;

    'docker ps' to get the container ID. 'docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}} * container-id*' which gave me the IP.

    This worked for;

    CHANNEL_LAYERS = {
        'default': {
            'BACKEND': 'channels_redis.core.RedisChannelLayer',
            'CONFIG': {
                "hosts": [('172.20.0.1', 6379)],
            },
        },
    }
    

提交回复
热议问题