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

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

    Turns out I needed to set up things like this for it to work on Heroku.

    redis_url = os.getenv('REDISTOGO_URL')
    
    urlparse.uses_netloc.append('redis')
    url = urlparse.urlparse(redis_url)
    conn = Redis(host=url.hostname, port=url.port, db=0, password=url.password)
    

提交回复
热议问题