String instead of urlparse.ParseResult for redis_url on Heroku (Django) -


would appreciate input experience configuring redis backend celery-brokered django project on heroku. task scheduling worked fine localhost i'm finding frustrating getting deployed on heroku:

  • at moment i'm running 3 dynos, 1 web, 1 scheduler , 1 worker
  • i added redistogo addon project. redistogo set free nano plan, gives me 10 connections, 1 db , 5mb size instance
  • i followed redistogo documentation (https://devcenter.heroku.com/articles/redistogo#install-redis-in-python) configuring settings.py and, alternatively, tried implementing variation of solution here. neither working me. here's have in settings.py:

     redis_url = os.environ.get('redistogo_url', 'http://localhost:6959')   caches = {         'default': {         'backend': 'redis_cache.rediscache',,         'location': '%s:%s' % (redis_url.hostname, redis_url.port),         'options': {             'db': 0,   # or 1?             'password': redis_url.password,             #'parser_class': 'redis.connection.hiredisparser'         },     },  }  celery_result_backend = redis_url broker_url = 'redis://localhost:6959/0' 

here's heroku logs when try run app:

2013-07-11t12:16:10.998516+00:00 app[web.1]:     apps = settings.installed_apps 2013-07-11t12:16:10.998516+00:00 app[web.1]:     mod = importlib.import_module(self.settings_module) 2013-07-11t12:16:10.998263+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute 2013-07-11t12:16:10.998263+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 263, in fetch_command 2013-07-11t12:16:10.998516+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__ 2013-07-11t12:16:10.998516+00:00 app[web.1]:     self._setup(name) 2013-07-11t12:16:10.998516+00:00 app[web.1]:     self._wrapped = settings(settings_module) 2013-07-11t12:16:10.998516+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 132, in __init__ 2013-07-11t12:16:10.998516+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module 2013-07-11t12:16:10.998516+00:00 app[web.1]:   file "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in _setup 2013-07-11t12:16:10.998712+00:00 app[web.1]:     'location': '%s:%s' % (redis_url.hostname, redis_url.port), 2013-07-11t12:16:10.998712+00:00 app[web.1]: attributeerror: 'str' object has no attribute 'hostname' 2013-07-11t12:16:12.201202+00:00 heroku[web.1]: process exited status 1 2013-07-11t12:16:12.250743+00:00 heroku[web.1]: state changed starting crashed 

how redis_url treated uri , not str?

my procfile:

web: python manage.py run_gunicorn -b 0.0.0.0:$port -w 3 --log-level info scheduler: python manage.py celeryd -b -e worker: python manage.py celeryd -e -b --loglevel=info 

in requirements have django-redis-cache==0.10.0, redis==2.7.6, django-celery==3.0.17, celery celery==3.0.20 , kombu==2.5.12

looks os.environ.get returning string (or str? not familiar python) , you're expecting more uri object or something. normal python strings respond methods hostname?

the documentation has step:

redis = redis.from_url(redis_url)

which according these docs parses string redis object.


Comments