Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have set up memcached in Django using Pylibmc binding:

    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
        'LOCATION': ['',

I tested on server with django shell, and the memcached pool workse for getting and setting values in memcached. But when I try to set

SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"   OR
SESSION_ENGINE = "django.contrib.sessions.backends.cache"

my website can still be accessed, but halts when user pressed login button. So I guess this must be the problem with session backend. My website works fine by using database as session backend. I cannot find any related error in apache or website error log, and /var/log/memcached.log is empty.


share|improve this question

I guess this is a bug of Pylibmc, although the reason of the bug is still unknown. The weired thing is that when I tried the same code in management/commands/, it works just fine. But I can't even cache.set(key, value) in views, which will cause the page to halt.

So I switched back to python-memcached, and it works.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.