How to connect to redis with dokku and flask? -


i wanted use redis dokku , flask. first issue installing current version of dokku, using latest version repo now.

second problem showing in flask debugger:

redis.exceptions.connectionerror connectionerror: error 111 connecting none:6379. connection refused. 

i set redis url , port in flask:

app.config['redis_url'] = 'ip:32768'                                                                                          

-----> checking status of redis remote: found image redis/landing remote: checking status...stopped. remote: launching redis/landing...command: docker run -v /home/dokku/.redis/volume-landing:/var/lib/redis -p 6379 -d redis/landing /bin/start_redis.sh -----> setting config vars redis_url: redis://ip:6379 redis_ip: ip redis_port: 6379

any idea? redis_url should set in different way?

this code works ok in localhost: https://github.com/kwikiel/bounce (with ['redis_ip'] = '172.17.0.13' set 127.0.0.1)

problem appears when try connect redis dokku.

steps use redis flask , dokku:

  1. install redis plugin:

    cd /var/lib/dokku/plugins

    git clone https://github.com/ohardy/dokku-redis redis

    dokku plugins-install

  2. link redis container application container

    dokku redis:create [name of app container]

you receive info environmental variables have set - example:

   host: 172.17.0.91    public port: 32771 

then set these settings in flask (or other framework)

app.config['redis_url'] =  'redis://172.17.0.91:6379'  app.config['redis_ip'] = '172.17.0.91'                                       app.config['redis_port'] = '6379'    

complete example of redis database used flask app (a/b testing in flask):

https://github.com/kwikiel/bounce


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -