Search code examples
pythondjangoherokuredisredistogo

RQScheduler on Heroku


I'm trying to run rqscheduler with django-rq on Heroku with RedisToGo. I've implemented django-rq as described in their readme (https://github.com/ui/django-rq).

I have a worker that starts an rqworker, and another worker that starts up rqscheduler using the management command suggested in the readme. The rqworker starts up successfully, but I keep running into this error with rqscheduler:

redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.

In my settings, I have this configuration for the my Redis Queues:

RQ_QUEUES = {
'default': {
    'HOST': 'localhost',
    'PORT': 6379,
    'DB': 0,
    'PASSWORD': '*****',
    'DEFAULT_TIMEOUT': 500,
},
'high': {
    'URL': os.getenv('REDISTOGO_URL', 'redis://localhost:6379/0'), # If you're on Heroku
    'DEFAULT_TIMEOUT': 500,
},
'low': {
    'HOST': 'localhost',
    'PORT': 6379,
    'DB': 0,
}
}

and I have this in my Procfile:

web: gunicorn app.wsgi --log-file -
worker: python manage.py rqworker high
scheduler: python manage.py rqscheduler

Any thoughts on why this might be happening?


Solution

  • If this is relevant to anyone, simple answer to the problem. Use the argument --queue when running the scheduler management command like this:

    python manage.py rqscheduler --queue high