Django-nonrel import cache fail

Iftah picture Iftah · Mar 11, 2012 · Viewed 9.3k times · Source

I am trying to setup django-nonrel on GAE (Google App Engine) - following the steps here http://www.allbuttonspressed.com/projects/djangoappengine#installation

The test application works great -

I was able to use the cache API in the application, but not so for the tests and shell:

Attempting to from django.core.cache import cache in the shell gives me:

>>> from django.core.cache import cache
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "django-testapp/django/core/cache/__init__.py", line 182, in <module>
    cache = get_cache(DEFAULT_CACHE_ALIAS)
  File "django-testapp/django/core/cache/__init__.py", line 180, in get_cache
    return backend_cls(location, params)
  File "django-testapp/django/core/cache/backends/memcached.py", line 154, in __init__
    import memcache
ImportError: No module named memcache

Similarly attempting ./manage.py test fails the same way.

Any idea why ./manage runserver works fine, but ./manage shell or ./manage test fails to import cache?

Answer

Matej Puntar picture Matej Puntar · Mar 11, 2012

I had the same problem when I upgraded to Google App Engine 1.6.0 from 1.5.5 .

I solved the problem by installing python-memcached:

pip install python-memcached