Django的缓存模块能否在Google App Engine上运行? [英] Will Django's cache modules work on Google App Engine?

查看:139
本文介绍了Django的缓存模块能否在Google App Engine上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Google App Engine上运行Django(1.0.2),并且想知道以下 Django缓存模块本来适用于 Google的memcache 实现:

I am running Django (1.0.2) on Google App Engine, and would like to know which (if any) of the following Django caching modules ought to inherently work with Google's memcache implementation:

Middlewear


  • django.middleware.cache.UpdateCacheMiddleware

  • django.middleware.cache.UpdateCacheMiddleware

django.middleware.common.CommonMiddleware

django.middleware.common.CommonMiddleware

django.middleware.cache.FetchFromCacheMiddleware

django.middleware.cache.FetchFromCacheMiddleware

strong>

Decorators


  • django.views.decorators.cache.cache_page

模板片段缓存

在模板中:

{{ load cache }}{% cache 500 cache_name %}...cached...{% endcache %}

低级API


  • django.core.cache

如果这些模块有部分或全部应该可以正常工作,在使用它们时应该注意什么问题或陷阱?

If some or all of these modules ought to work, are there any changes necessary to make them work properly, and are there any concerns or pitfalls ought one be aware of when using them?

我已经仔细阅读了这些文档,花费了一些时间来搜索Google,但是我还没有看到这个答案。我怀疑它可能是一个交钥匙的解决方案,但是对于使用Django类而言至少有一个引用,其他人没有发生任何问题,我担心。

I've perused the documentation and spent some time searching Google, but I haven't seen the answer to this. I suspect it may be a "turn-key" solution, but am wary of using the Django classes without at least one reference that someone else has done it without issue.

谢谢你。

推荐答案

在Google App Engine上运行Django 说:可以在Google App Engine上使用几乎整个Django堆栈,包括中间件。此外,该页面还有一个例子,其中包含您询问的一个类,所以至少应该有一个这样的工作:

Running Django on Google App Engine says "it is possible to use nearly the entire Django stack on Google App Engine, including middleware." Also, that page has an example which includes one of the classes you asked about, so at least that one ought to work:

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
...

各种网站,例如这一个有使用AppEngine和Django缓存代码的代码,如django.middleware.cache.UpdateCacheMiddleware。请参阅这个Google搜索为其他参考,质量不同。)

Various sites such as this one have code for using AppEngine and the Django caching code, such as django.middleware.cache.UpdateCacheMiddleware. See this Google search for other references, of varying quality. ;)

我没有实际使用这个东西,所以我只能用别人的话,但是看起来好像有很多人这样做。

I haven't actually used this stuff, so I can only take others' word for it, but it does seem as though multiple people have done it.

编辑: Django门票< a href =http://code.djangoproject.com/ticket/7398 =nofo llow noreferrer> 7398 和 7399 与此相关。

Django tickets 7398 and 7399 are relevant to this.

这篇关于Django的缓存模块能否在Google App Engine上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆