运行Django本地服务器时出错:__init __()得到了意外的关键字参数'tcp_nodelay'` [英] Error running django local server: `__init__() got an unexpected keyword argument 'tcp_nodelay'`

查看:57
本文介绍了运行Django本地服务器时出错:__init __()得到了意外的关键字参数'tcp_nodelay'`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一切都很好,并且始终可以正常运行.现在,当我从浏览器加载应用程序时出现错误.似乎与代码无关,因为我跳到了最旧的分支,并且得到了相同的错误.这是我的python和django版本

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)

当我尝试加载127.0.0.1:8000网址时出现错误

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

推荐答案

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

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

这篇关于运行Django本地服务器时出错:__init __()得到了意外的关键字参数'tcp_nodelay'`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆