python - 错误导入中间件 django.middleware.cache : "No module named memcache"

标签 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 )

最佳答案

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

After installing Memcached itself, you’ll need to install a memcached binding. There are several python memcached bindings available; the two most common are python-memcached and pylibmc.

Quote reference

关于python - 错误导入中间件 django.middleware.cache : "No module named memcache",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22178474/

相关文章:

python - Python 中的多元逻辑回归

python - 如何使用 Flask CORS 将域列入白名单

python - 通过POST创建资源指定相关字段ID

python - 尝试更新单个 Django 表单/模型字段失败,因为未提供用户 ID(外键)

python - 如何使用三角矩阵使 np.where 更高效?

python - 如何在 pandas 中为 columns 参数进行多列转换

django-compressor:使用预编译器禁用缓存

caching - Couchbase 作为缓存和缓存失效

c# - Windows 的键值数据库?

ruby-on-rails - ruby on Rails : Rails. cache.write 对于特定对象字段数组返回 false