django-rosetta error: You can't use the CacheRosettaStorage

281 Views Asked by At

I'm using django-rosetta app, it works on development without a CACHES setting, but on prod I've this setting as follow:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': '127.0.0.1:11211',
    }
}

The problem is that under prod it raises me

django.core.exceptions.ImproperlyConfigured:
You can't use the CacheRosettaStorage if your cache isn't correctly set up, 
please double check your Django DATABASES setting and that the cache server is responding

The database setting is simple as

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}
1

There are 1 best solutions below

0
On BEST ANSWER

So, as the exception message sais:

double check your Django DATABASES setting and that the cache server is responding

I did it, even my memchached was working correctly I decided reinstall it, and, as magic art, it worked!

Before that I changed my CACHES

CACHES = {
 'default': {
    'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
    'LOCATION': '127.0.0.1:11211',
 },
 'rosetta': {
    'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
    'LOCATION': '/var/tmp/django_cache',
 }
}

Django rosetta will use a key rosetta if a cache with this name exists, or default if not. With the FileBasedCache it wasn't launch any error, so I realized the problem was with MemcachedCache. But, after reinstall it, it worked.