mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-05 23:18:11 +08:00
ability to use a Redis connection URI - closes #402
This commit is contained in:
@@ -59,4 +59,6 @@ class Redis(Broker):
|
|||||||
def get_connection(list_key=Conf.PREFIX):
|
def get_connection(list_key=Conf.PREFIX):
|
||||||
if django_redis and Conf.DJANGO_REDIS:
|
if django_redis and Conf.DJANGO_REDIS:
|
||||||
return django_redis.get_redis_connection(Conf.DJANGO_REDIS)
|
return django_redis.get_redis_connection(Conf.DJANGO_REDIS)
|
||||||
|
if isinstance(Conf.REDIS, str):
|
||||||
|
return redis.from_url(Conf.REDIS)
|
||||||
return redis.StrictRedis(**Conf.REDIS)
|
return redis.StrictRedis(**Conf.REDIS)
|
||||||
|
|||||||
@@ -180,6 +180,12 @@ Connection settings for Redis. Defaults::
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
It's also possible to use a Redis connection URI:
|
||||||
|
|
||||||
|
Q_CLUSTER = {
|
||||||
|
'redis': 'redis://h:asdfqwer1234asdf@ec2-111-1-1-1.compute-1.amazonaws.com:111'
|
||||||
|
}
|
||||||
|
|
||||||
For more information on these settings please refer to the `Redis-py <https://github.com/andymccurdy/redis-py>`__ documentation
|
For more information on these settings please refer to the `Redis-py <https://github.com/andymccurdy/redis-py>`__ documentation
|
||||||
|
|
||||||
.. _django_redis:
|
.. _django_redis:
|
||||||
|
|||||||
Reference in New Issue
Block a user