gpt4 book ai didi

Django-nonrel 导入缓存失败

转载 作者:行者123 更新时间:2023-12-03 09:24:21 26 4
gpt4 key购买 nike

我正在尝试在 GAE (Google App Engine) 上设置 django-nonrel -
按照此处的步骤操作 http://www.allbuttonspressed.com/projects/djangoappengine#installation

测试应用程序运行良好 -

我能够在应用程序中使用缓存 API,但对于测试和 shell 却不是这样:

正在尝试 from django.core.cache import cache在 shell 中给了我:

>>> 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

同样尝试 ./manage.py test以同样的方式失败。

知道为什么 ./manage runserver工作正常,但 ./manage shell./manage test导入缓存失败?

最佳答案

当我从 1.5.5 升级到 Google App Engine 1.6.0 时遇到了同样的问题。

我通过安装 python-memcached 解决了这个问题:

pip install python-memcached

关于Django-nonrel 导入缓存失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9653905/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com