运行django本地服务器时出错:`__init __()得到了一个意外的关键字参数' tcp_nodelay'`

时间:2017-09-19 06:54:50

标签: python django

一切都很好,总是没有问题。现在,当我从浏览器加载应用程序时,我收到错误。似乎没有与代码相关的东西,因为我跳过最旧的分支,我得到了同样的错误。这是我的python和django版本

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

这是我尝试加载127.0.0.1:8000网址时的错误

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'

任何建议在哪里寻找解决这个令人讨厌的问题?谢谢

1 个答案:

答案 0 :(得分:2)

我遇到了相同的错误,在我的情况下,这是与settings.py文件中的缓存设置有关的问题,请检查缓存设置的选项键中是否可能有类似的内容

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

我删除了选项,对我有用