Skip to content

Commit

Permalink
Update Db selection for Redis cache urls
Browse files Browse the repository at this point in the history
  • Loading branch information
alorence committed Feb 7, 2017
1 parent 43d572f commit a4b38a2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ This is your `settings.py` file before you have installed **django-environ**
},
'redis': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': '127.0.0.1:6379:1',
'LOCATION': '127.0.0.1:6379/1',
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
'PASSWORD': 'redis-githubbed-password',
Expand Down Expand Up @@ -116,7 +116,7 @@ Create a ``.env`` file:
DATABASE_URL=psql://urser:[email protected]:8458/database
# SQLITE_URL=sqlite:///my-local-sqlite.db
CACHE_URL=memcache://127.0.0.1:11211,127.0.0.1:11212,127.0.0.1:11213
REDIS_URL=rediscache://127.0.0.1:6379:1?client_class=django_redis.client.DefaultClient&password=redis-un-githubbed-password
REDIS_URL=rediscache://127.0.0.1:6379/1?client_class=django_redis.client.DefaultClient&password=redis-un-githubbed-password
How to install
Expand Down
8 changes: 4 additions & 4 deletions environ/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BaseTests(unittest.TestCase):
ORACLE_TNS = 'oracle://user:password@sid/'
ORACLE = 'oracle://user:password@host:1521/sid'
MEMCACHE = 'memcache://127.0.0.1:11211'
REDIS = 'rediscache://127.0.0.1:6379:1?client_class=django_redis.client.DefaultClient&password=secret'
REDIS = 'rediscache://127.0.0.1:6379/1?client_class=django_redis.client.DefaultClient&password=secret'
EMAIL = 'smtps://[email protected]:[email protected]:587'
JSON = dict(one='bar', two=2, three=33.44)
DICT = dict(foo='bar', test='on')
Expand Down Expand Up @@ -208,7 +208,7 @@ def test_cache_url_value(self):

redis_config = self.env.cache_url('CACHE_REDIS')
self.assertEqual(redis_config['BACKEND'], 'django_redis.cache.RedisCache')
self.assertEqual(redis_config['LOCATION'], 'redis://127.0.0.1:6379:1')
self.assertEqual(redis_config['LOCATION'], 'redis://127.0.0.1:6379/1')
self.assertEqual(redis_config['OPTIONS'], {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
'PASSWORD': 'secret',
Expand Down Expand Up @@ -439,11 +439,11 @@ def test_dummycache_parsing(self):
self.assertEqual(url['LOCATION'], '')

def test_redis_parsing(self):
url = 'rediscache://127.0.0.1:6379:1?client_class=django_redis.client.DefaultClient&password=secret'
url = 'rediscache://127.0.0.1:6379/1?client_class=django_redis.client.DefaultClient&password=secret'
url = Env.cache_url_config(url)

self.assertEqual(url['BACKEND'], REDIS_DRIVER)
self.assertEqual(url['LOCATION'], 'redis://127.0.0.1:6379:1')
self.assertEqual(url['LOCATION'], 'redis://127.0.0.1:6379/1')
self.assertEqual(url['OPTIONS'], {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
'PASSWORD': 'secret',
Expand Down
2 changes: 1 addition & 1 deletion environ/test_env.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ BOOL_FALSE_VAR2=False
DATABASE_MYSQL_URL=mysql://bea6eb0:[email protected]/heroku_97681?reconnect=true
DATABASE_MYSQL_GIS_URL=mysqlgis://user:[email protected]/some_database
CACHE_URL=memcache://127.0.0.1:11211
CACHE_REDIS=rediscache://127.0.0.1:6379:1?client_class=django_redis.client.DefaultClient&password=secret
CACHE_REDIS=rediscache://127.0.0.1:6379/1?client_class=django_redis.client.DefaultClient&password=secret
EMAIL_URL=smtps://[email protected]:[email protected]:587
URL_VAR=http://www.google.com/
PATH_VAR=/home/dev
Expand Down

0 comments on commit a4b38a2

Please sign in to comment.