Django nonrel Django Nonl导入缓存失败
我正在尝试在GAE(谷歌应用程序引擎)上设置django Nonl- 按照这里的步骤 测试应用程序非常有效- 我能够在应用程序中使用缓存API,但在测试和shell中却不是这样: 尝试从django.core.cache导入shell中的缓存,会得到:Django nonrel Django Nonl导入缓存失败,django-nonrel,Django Nonrel,我正在尝试在GAE(谷歌应用程序引擎)上设置django Nonl- 按照这里的步骤 测试应用程序非常有效- 我能够在应用程序中使用缓存API,但在测试和shell中却不是这样: 尝试从django.core.cache导入shell中的缓存,会得到: >>> from django.core.cache import cache Traceback (most recent call last): File "<console>", line 1, in &l
>>> 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
>>来自django.core.cache导入缓存
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“django testapp/django/core/cache/_init__.py”,第182行,在
缓存=获取缓存(默认缓存别名)
文件“django testapp/django/core/cache/_init__.py”,第180行,在get_缓存中
返回后端_cls(位置、参数)
文件“django testapp/django/core/cache/backends/memcached.py”,第154行,在__
导入memcache
ImportError:没有名为memcache的模块
同样,尝试/manage.py测试
也会以同样的方式失败
知道为什么
/manage runserver
工作正常,但是/manage shell
或/manage test
无法导入缓存吗?当我从1.5.5升级到Google App Engine 1.6.0时,我也遇到了同样的问题
我通过安装python memcached
解决了这个问题:
pip install python-memcached
对于gentoo用户,建议:
emerge-av dev python/python memcached
我也这样做:
sudo pip install python-memcached
然后重新启动django,它就工作了。我在OSX上运行服务器时遇到了这个问题,它对我起了作用。谢谢