1

shared host: mochahost, setup memcached. Error importing middleware django.middleware.cache: "No module named 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"

Please help me ! ( sorry, not good english :D )

2
  • 1
    Have you installed memcached? pip install python-memcached Commented Mar 4, 2014 at 20:35
  • Maybe this heroku guide on how to setup memcache with django can help you. devcenter.heroku.com/articles/… Commented Dec 11, 2016 at 11:22

1 Answer 1

6

memcached is a daemon. For your program to use it you must load a driver module that allows you to access it.

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

Sign up to request clarification or add additional context in comments.

3 Comments

I've downloaded python-memcached-1:53, but did not know how to install on mochahost.
It depends what kind of access you get on mochahost. Maybe you could talk to their support team?
Thanks to @BoJack_Horseman for the clarifying edit and link addition.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.