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

后端 未结 12 1184
感动是毒
感动是毒 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:27

    I was facing same the error

    • Maybe radis server was not installed in your environment

      sudo apt-get install redis-server

    • I needed to set up things like this in settings.py

      redis_host = os.environ.get('REDIS_HOST', 'localhost')    
      # Channel layer definitions
      # http://channels.readthedocs.org/en/latest/deploying.html#setting-up-a-channel-backend
      CHANNEL_LAYERS = {
          "default": {
              # This example app uses the Redis channel layer implementation asgi_redis
              "BACKEND": "asgi_redis.RedisChannelLayer",
              "CONFIG": {
                  "hosts": [(redis_host, 6379)],
              },
              "ROUTING": "multichat.routing.channel_routing",
          },
      }
      
    • Before

    • After

提交回复
热议问题