Connecting to a Redis instance that isn't hosted locally
0xAtomist opened this issue · comments
Hi guys,
Love your work, getting really nice results when working locally but struggling to push this into the cloud. Even hosting the app locally I cannot get the RedisStore to redirect to a seperate URL. There is no documentation for this and I have attempted several different ways. The main problem I think being that you must initialise the app with the transforms=[ServersideOutputTransform(backend=RedisStore())]
before any config variables can be set on flask_caching's Cache()
. Therefore I cannot configure the Cache()
before feeding it into RedisStore()
.
Error is always Error 61 connecting to localhost:6379. Connection refused.
- because I am not hosting the Redis server locally.
Any help is greatly appreciated.
Thanks! You can pass keyword arguments to the underlying RedisCache object via the RedisStore constructor. See the details here,
Thanks for the quick response, although I'm still missing something obviously.
Loading app as so:
from flask_caching.backends import RedisCache
from dash_extensions.enrich import DashProxy, ServersideOutputTransform, RedisStore
app = DashProxy( __name__, transforms=[ServersideOutputTransform(backend=RedisStore(RedisCache(host='url.com', port=25061, password='password')))])
Arguments don't seem to be picked up by RedisCache object at all.
Ah, so what I meant was passing the arguments directly, so something like this,
rs = RedisStore(host='url.com', port=25061, password='password')
app = DashProxy( __name__, transforms=[ServersideOutputTransform(backend=rs)])
I see, thanks! Sorry the confusion on my part.
FYI, for any others, I am using a TLS secured managed Redis service. As such I have also had to add the following arguments:
RedisStore(ssl=True, ssl_cert_reqs="none")