Error 111 connecting to localhost:6379. Connection refused. Django Heroku

后端 未结 12 1160
感动是毒
感动是毒 2020-12-28 12:33

I am able to run redis locally and everything works.

However when I deploy to heroku I get this error:

Error 111 connecting to localhost:6379. Conn         


        
12条回答
  •  情话喂你
    2020-12-28 13:20

    Error 111 is thrown when the application is unable to contact Redis. I had the same problem following the Heroku Django Channels tutorial. The settings.py file should read:

    CHANNEL_LAYERS = {
        "default": {
            "BACKEND": "asgi_redis.RedisChannelLayer",
            "CONFIG": {
                "hosts": [os.environ.get('REDISCLOUD_URL', 'redis://localhost:6379')],
            },
            "ROUTING": "chat.routing.channel_routing",
        },
    }
    

    REDISCLOUD_URL instead of REDIS_URL.

    Ensure Redis is installed on the Heroku server.

提交回复
热议问题