导入中间件django.middleware.cache时出错:“没有名为memcache的模块”

时间:2014-03-04 17:11:50

标签: python django memcached

共享主机:mochahost,设置memcached。导入中间件django.middleware.cache时出错:“没有名为memcache的模块”

Traceback (most recent call last):

File "/opt/Python2.7/lib/python2.7/site-packages/mod_python/importer.py", line 1537, 
in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

File "/opt/Python2.7/lib/python2.7/site-packages/mod_python/importer.py", line 1229, 
in _process_target
result = _execute_target(config, req, object, arg)

File "/opt/Python2.7/lib/python2.7/site-packages/mod_python/importer.py", line 1128, 
in _execute_target
result = object(arg)

File "/home2/minhhien/webapps/django/core/handlers/modpython.py", line 180, in handler
return ModPythonHandler()(req)

File "/home2/minhhien/webapps/django/core/handlers/modpython.py", line 142, in __call__
self.load_middleware()

File "/home2/minhhien/webapps/django/core/handlers/base.py", line 47, in 
load_middleware
raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % 
(mw_module, e))

ImproperlyConfigured: Error importing middleware django.middleware.cache: "No module 
named memcache"

请帮帮我! (抱歉,英语不好:D)

1 个答案:

答案 0 :(得分:5)

memcached是一个守护进程。要使程序使用它,您必须加载一个允许您访问它的驱动程序模块。

  

安装Memcached本身后,您需要安装memcached   捆绑。有几个python memcached绑定可用;该   两个最常见的是python-memcached和pylibmc。

Quote reference