I’m running a Django 1.3 instance with a memcached backend for a caching layer, recently I’ve been trying to debug a part of the database for the application, but whenever I take the memcached server offline, I get the following error:
AttributeError at /joinerysoft/contacts/ajax/all/None/None/
'NoneType' object has no attribute 'sendall'
Request Method: GET
Request URL: http://joinerysoft-directory.co.uk/joinerysoft/contacts/ajax/all/None/None/
Django Version: 1.3.1
Exception Type: AttributeError
Exception Value: 'NoneType' object has no attribute 'sendall'
Exception Location: /usr/lib/python2.7/dist-packages/memcache.py in send_cmd, line 1112
Python Executable: /usr/bin/python
Python Version: 2.7.3
I thought the attractive part of memcached + django is that if the memcache disappears, your site will still function (albeit crippled) until it returned. I do use Django’s Built in Caching.
First of all this is not an error from Django, but from the python-memcached library.
Second I think this behaviour is consistent. If you configured Django to use memcached and it goes down, then it should throw an error! Assuming your site depends heavily on cache, you also want to know ASAP if something happens and not figure out a couple days later that your whole DB is down as well because there where too many queries (as an example).
There are ways to define a fallback cache or do other workarounds. Check out this similiar question: Is there a way to ignore Cache errors in Django?