Merge branch 'asldevi-master'

This commit is contained in:
Vincent Driessen 2013-09-02 23:12:08 +02:00
commit d037696fc5
1 changed files with 21 additions and 11 deletions

View File

@ -1,5 +1,6 @@
import importlib
import redis
from warnings import warn
from rq import use_connection
@ -20,6 +21,7 @@ def add_standard_arguments(parser):
parser.add_argument('--socket', '-s', default=None,
help='The Redis Unix socket')
def read_config_file(module):
"""Reads all UPPERCASE variables defined in the given module file."""
settings = importlib.import_module(module)
@ -30,6 +32,14 @@ def read_config_file(module):
def setup_default_arguments(args, settings):
""" Sets up args from settings or defaults """
if args.url is None:
args.url = settings.get('REDIS_URL')
if (args.host or args.port or args.socket or args.db or args.password):
warn('Host, port, db, password options for Redis will not be '
'supported in future versions of RQ. '
'Please use `REDIS_URL` or `--url` instead.', DeprecationWarning)
if args.host is None:
args.host = settings.get('REDIS_HOST', 'localhost')