Error running django local server: `__init__() got an unexpected keyword argument 'tcp_nodelay'`

Viewed 571

Everything was fine and always run without problem. Now I get the error when I load the app from the browser. Seems not something related to the code because I jumped on a oldest branch and I get the same error. Here my python and django version

$ python --version
Python 3.6.0
$ python -c "import django; print(django.VERSION)"
(1, 11, 5, 'final', 0)

Here the error when I try to load the 127.0.0.1:8000 url

Traceback:

File "/Users/karim/Envs/ec/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/Users/karim/Envs/ec/lib/python3.6/site-packages/django/core/handlers/base.py" in _legacy_get_response
  244.             response = middleware_method(request)

File "/Users/karim/Envs/ec/lib/python3.6/site-packages/django/middleware/cache.py" in process_request
  133.         cache_key = get_cache_key(request, self.key_prefix, 'GET', cache=self.cache)

File "/Users/karim/Envs/ec/lib/python3.6/site-packages/django/utils/cache.py" in get_cache_key
  362.     headerlist = cache.get(cache_key)

File "/Users/karim/Envs/ec/lib/python3.6/site-packages/django/core/cache/backends/memcached.py" in get
  79.         val = self._cache.get(key)

File "/Users/karim/Envs/ec/lib/python3.6/site-packages/django/core/cache/backends/memcached.py" in _cache
  172.             self._client = self._lib.Client(self._servers, **client_kwargs)

Exception Type: TypeError at /
Exception Value: __init__() got an unexpected keyword argument 'tcp_nodelay'

Any suggestion where to look to fix this nasty issue? Thank you

1 Answers

I had the same error, and in my case that was an issue related to the cache settings in the settings.py file, please check that maybe you have something like this in the options key for your cache settings

CACHES = {
'default': {
    'BACKEND': '-----',
    'TIMEOUT': 30000,
    'KEY_PREFIX': CACHE_MIDDLEWARE_KEY_PREFIX,
    'OPTIONS': {'ketama': True, 'tcp_nodelay': True}

I removed the options and it worked for me

Related