سؤال

So Im running into this CACHE error when I try to runserver or syncdb.

Here is the traceback: https://gist.github.com/1538051

I tried inserting this into the settings.py file:

CACHE_BACKEND = {
    'default': {
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
    }
}

But that gave another error which makes no sense to me.

if backend_uri.find(':') == -1:
AttributeError: 'dict' object has no attribute 'find'

Can someone help me figure what the problem is and how I can go about fixing it.

NB: I am working on the dev server

هل كانت مفيدة؟

المحلول

If you're using Django 1.2 or lower, CACHE_BACKEND (docs) accepts a string:

CACHE_BACKEND = 'dummy://'

If you're using Django 1.3+, CACHE_BACKEND has been deprecated in favour of CACHES (docs):

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
    }
}

I'm not sure why your installation isn't creating the appropriate default - it could be that there's something else going on with your installation, but I don't really have enough information without knowing more about your settings.py etc.

نصائح أخرى

First off, What version of django are you using? The dictionary- style backend config is new to django 1.3, and your traceback suggests that you are on something like 1.2.4.

If that's the case, you will need to use the older uri-style cache settings. Something like

CACHE_BACKEND = 'dummy://'

would match what you are trying to set in your question.

The full documentation on caching, relevant to Django 1.2, is available here: http://docs.djangoproject.com/en/1.2/topics/cache/

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top