Forums

What LOCATION should I point Memcached to after deployment?

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

I need to change 'LOCATION' to replace localhost. Any guidance?

We don't support memcached at the moment, so there's nothing you can put in LOCATION to make it work. I have upvoted the memcached ticket for you.

@glenn - Do we support memcached now on PAW?

No, but if you really want to do caching, you could try using redis-lite as your cache.

Any suggestions how to configure redis-lite for Django? I tried to do that with no luck...

what settings did you use?

I was completely wildguessing. I looked at the flask example, but I couldn't figure out what should I use as location here: CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", "LOCATION": "dev/shm/redis.db", "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", } } } Also, should it be working with a django-redis backend? Anyway, I'm not using the django app I was intending to use, which required caching, so for now I don't need this, but it might be useful as a general knowledge.

You need to get redislite to actually start the server and then use the config in your settings:

from redislite import StrictRedis

redis = StrictRedis("/dev/shm/cache.rdb")

CACHES = {
    'default': {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": "unix://@%s" % (redis.socket_file, )
    }
}

Thanks!