diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 2144392c3..1933e054a 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -6,12 +6,16 @@ Requirements - Django 1.6 or 1.7 - Python 2.6, 2.7, 3.2, 3.3, or 3.4 -- `django-redis `_, - `memcached `_, - `filebased `_ - (only with Django >= 1.7 as it is not thread-safe before), - or `locmem `_ - (but it’s not shared between processes, so don’t use it with RQ or Celery) +- a cache configured as `default` with one of these backends: + + - `django-redis `_ + - `memcached `_ + (using either python-memcached or pylibmc) + - `filebased `_ + (only with Django >= 1.7 as it was not thread-safe before) + - `locmem `_ + (but it’s not shared between processes, so don’t use it with RQ or Celery) + - PostgreSQL, MySQL or SQLite Usage diff --git a/runtests_requirements.txt b/runtests_requirements.txt index afcda50df..4b49be35e 100644 --- a/runtests_requirements.txt +++ b/runtests_requirements.txt @@ -3,4 +3,5 @@ psycopg2 MySQL-python django-redis python-memcached +pylibmc South diff --git a/settings.py b/settings.py index 93f232ca4..1e9247e1a 100644 --- a/settings.py +++ b/settings.py @@ -65,9 +65,18 @@ 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': '127.0.0.1:11211', }, + 'pylibmc': { + 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache', + 'LOCATION': '127.0.0.1:11211', + }, } -CACHES['default'] = CACHES.pop(os.environ.get('CACHE_BACKEND', 'locmem')) +DEFAULT_CACHE_ALIAS = os.environ.get('CACHE_BACKEND', 'locmem') +CACHES['default'] = CACHES.pop(DEFAULT_CACHE_ALIAS) +if DEFAULT_CACHE_ALIAS == 'memcached': + del CACHES['pylibmc'] +elif DEFAULT_CACHE_ALIAS == 'pylibmc': + del CACHES['memcached'] INSTALLED_APPS = [ diff --git a/tox.ini b/tox.ini index d8ebdfa8f..c4a1972cc 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,7 @@ [tox] envlist = - py2.6-django1.6-{sqlite3,postgresql,mysql}-{locmem,redis,memcached}, + py2.6-django1.6-{sqlite3,postgresql,mysql}-{locmem,redis,memcached,pylibmc}, + py2.7-django{1.6,1.7}-{sqlite3,postgresql,mysql}-pylibmc, py{2.7,3.2,3.3,3.4}-django1.7-{sqlite3,postgresql,mysql}-filebased, py{2.7,3.2,3.3,3.4}-django{1.6,1.7}-{sqlite3,postgresql,mysql}-{locmem,redis,memcached}, @@ -21,6 +22,7 @@ deps = py2.6: unittest2 py{2.6,2.7}: MySQL-python py{2.6,2.7}: python-memcached + py{2.6,2.7}: pylibmc py{3.2,3.3,3.4}: https://github.com/clelland/MySQL-for-Python-3/tarball/master py{3.2,3.3,3.4}: python3-memcached setenv = @@ -31,5 +33,6 @@ setenv = filebased: CACHE_BACKEND=filebased redis: CACHE_BACKEND=redis memcached: CACHE_BACKEND=memcached + pylibmc: CACHE_BACKEND=pylibmc commands = coverage run -a --source=cachalot ./runtests.py