Closed thedrow closed 10 years ago
I know I can use a little bit of glue code but it seems uneccessary. The code should simply detect if redis:// is the scheme and no backend is specified simply pick caches.interfaces.Redis.
I'm sorry it has taken me so long to get back to you, we've been insanely busy the last few months.
I created a small Heroku app today and was able to get caches working with very minimal effort, basically, once Redis is activated on the app, you can grab the dsn:
$ heroku config:get REDISTOGO_URL
redis://redistogo:d381fd671fe61c0f6d36bdb4c25d3050@grideye.redistogo.com:10174/
And then just modify that to point to caches.interface.Redis
and set it into the configuration value that caches likes:
$ heroku config:set CACHES_DSN=caches.interface.Redis://redistogo:d381fd671fe61c0f6d36bdb4c25d3050@grideye.redistogo.com:10174/
Now, just importing caches into your python code should handle all the configuring you need, with no other glue code necessary
import caches # this will automatically use CACHES_DSN and configure module
I'm going to go ahead and close this since it doesn't appear anything really needs to be changed to support Heroku and the current dsn is more explicit and consistent with our other libraries.
Hrm, I don't think I fully understand the problem. I've never used Heroku but it looks like you can set environment variables using config vars, so you could set the value for
CACHES_DSN
to something likecaches.interface.Redis://localhost:6379/0
and it should work as expected when you importcaches
as long as you have redis support.If you're using Redis to go and want to use its env variable,
REDISTOGO_URL
then you should be able to normalize the url into something caches can use with a small amount of glue code:I hope that helps and let me know what if my understanding of the problem is incorrect.