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.common.CommonMiddleware
django.middleware.cache.FetchFromCacheMiddleware
Decorators
- django.views.decorators.cache.cache_page
Template fragment caching
In a template:
{{ load cache }}{% cache 500 cache_name %}...cached...{% endcache %}
Low level API
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?
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.
Thank you kindly.
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',
...
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.
Edit: Django tickets 7398 and 7399 are relevant to this.
No, app engine provides a custom memcached API. What you'll need to do (and there may already be an open source implementation of this, I don't know), is write a Django cache backend for this API, they're pretty simple, you can use the existing memcached backend as the basis for your new one: http://code.djangoproject.com/browser/django/trunk/django/core/cache/backends/memcached.py . http://code.google.com/appengine/docs/python/memcache/usingmemcache.html shows what the App Engine memcached API looks like.
You should check this http://code.google.com/p/google-app-engine-django/
You want this
https://github.com/django-nonrel/djangoappengine