0

I installed johnny-cache 1.4 in Django 1.6 using the instructions but does not work:

# add johnny's middleware
MIDDLEWARE_CLASSES = (
    'johnny.middleware.LocalStoreClearMiddleware',
    'johnny.middleware.QueryCacheMiddleware',
    # ...
)
# some johnny settings
CACHES = {
    'default' : dict(
        BACKEND = 'johnny.backends.memcached.MemcachedCache',
        LOCATION = ['127.0.0.1:11211'],
        JOHNNY_CACHE = True,
    )
}
JOHNNY_MIDDLEWARE_KEY_PREFIX='jc_myproj'

the error that comes out is:

$ python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/diegoug/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/home/diegoug/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/diegoug/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/home/diegoug/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 75, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/home/diegoug/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/home/diegoug/local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/runserver.py", line 6, in <module>
    from django.contrib.staticfiles.handlers import StaticFilesHandler
  File "/home/diegoug/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 8, in <module>
    from django.contrib.staticfiles.views import serve
  File "/home/diegoug/local/lib/python2.7/site-packages/django/contrib/staticfiles/views.py", line 15, in <module>
    from django.contrib.staticfiles import finders
  File "/home/diegoug/local/lib/python2.7/site-packages/django/contrib/staticfiles/finders.py", line 12, in <module>
    from django.contrib.staticfiles.storage import AppStaticStorage
  File "/home/diegoug/local/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 8, in <module>
    from django.core.cache import (get_cache, InvalidCacheBackendError,
  File "/home/diegoug/local/lib/python2.7/site-packages/django/core/cache/__init__.py", line 138, in <module>
    cache = get_cache(DEFAULT_CACHE_ALIAS)
  File "/home/diegoug/local/lib/python2.7/site-packages/django/core/cache/__init__.py", line 130, in get_cache
    "Could not find backend '%s': %s" % (backend, e))
django.core.cache.backends.base.InvalidCacheBackendError: Could not find backend 'johnny.backends.memcached.MemcachedCache': 'module' object has no attribute 'CacheClass'

Investigate and say the problem is more of Django, I would like to fix it, because this is a great tool and it would be great help.

user987055
  • 1,039
  • 4
  • 14
  • 25

1 Answers1

1

Upgrade to Django version 1.7 which updated today, continuing the same problem, what I did was upgrade to version johnny cache development:

johnny-cache==1.6.1a
python-memcached==1.53

with this I am resolved the problem temporarily until they update

user987055
  • 1,039
  • 4
  • 14
  • 25
  • 1
    Don’t use johnny-cache 1.6.1a, it’s broken with Django 1.6. The tests are passing but that doesn’t mean the tests are correct. – Bertrand Bordage Oct 09 '14 at 00:09
  • 1
    Johnny-cache became a mess, use [django-cachalot](https://github.com/BertrandBordage/django-cachalot) instead. I tried to fix johnny-cache, but ended up rewriting a new project… – Bertrand Bordage Oct 09 '14 at 00:10