Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to use a Redis URI #402

Closed
valentinogagliardi opened this issue Jan 10, 2020 · 0 comments
Closed

Ability to use a Redis URI #402

valentinogagliardi opened this issue Jan 10, 2020 · 0 comments

Comments

@valentinogagliardi
Copy link
Contributor

Thanks for this nice project!

Most cloud providers give a Redis connection URI like redis://h:asdfqwer1234asdf@ec2-111-1-1-1.compute-1.amazonaws.com:111. The current implementation of django-q does not allow this format. Would be nice to have the ability to set it in the cluster configuration:

Q_CLUSTER = {
    'name': 'project name',
    # omit
    'label': 'Django Q',
    'redis': 'redis://h:asdfqwer1234asdf@ec2-111-1-1-1.compute-1.amazonaws.com:111'
}

That would be in line with the redis-py native url notation. I took a look at redis_broker.py and shouldn't be hard to tweak the relevant method:

    @staticmethod
    def get_connection(list_key=Conf.PREFIX):
        if django_redis and Conf.DJANGO_REDIS:
            return django_redis.get_redis_connection(Conf.DJANGO_REDIS)
        return redis.StrictRedis(**Conf.REDIS)

Let me know if there is any interested in this. I'd start working on a PR.

@Koed00 Koed00 closed this as completed in fa1082f Jan 17, 2020
Koed00 added a commit that referenced this issue Jan 17, 2020
ability to use a Redis connection URI - closes #402
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant