Django development server showing Error 61 Connection Refused with Redis

MiniGunnR picture MiniGunnR · Jun 11, 2016 · Viewed 10.9k times · Source

I am trying to follow the tutorial on read the docs for Django Channels. In the settings.py file I am trying to change the inmemory BACKEND to the redis backend with the following code:

CHANNEL_LAYERS = {
    "default": {
        "BACKEND": "asgi_redis.RedisChannelLayer",
        "CONFIG": {
            "hosts": [("localhost", 6379)],
        },
        "ROUTING": "chan.routing.channel_routing",
    },
}

However, the moment I do this, the console which is running the runserver command shows the following error:

ConnectionError: Error 61 connecting to localhost:6379. Connection refused.

How can I fix this?

Answer

MicroPyramid picture MicroPyramid · Jun 11, 2016

Please make sure if redis is installed on your system and it is running. To check if redis is running use

 redis-cli

then it will take you to redis console, then if you type ping it will return PONG if redis is running or not.

If you don't have redis in your system, please visit Redis Quick Start.

For Mac OS X: Go to terminal and type brew install redis.