GAEfan
unread,Nov 12, 2009, 12:52:07 AM11/12/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google App Engine
I am trying to implement Django's Cache Middleware, and can't seem to
get it to work. Here is what I have:
settings.py:
MIDDLEWARE_CLASSES = (
'django.middleware.cache.UpdateCacheMiddleware', # this must be
first
'ragendja.middleware.ErrorMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', # this
must be before CacheMiddleware
#'django.middleware.cache.CacheMiddleware', #
'django.middleware.common.CommonMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware', # this must be
last
)
CACHE_MIDDLEWARE_SECONDS = 300
CACHE_MIDDLEWARE_KEY_PREFIX = ''
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
CACHE_BACKEND = 'memcached://?timeout=120'
By using apiproxy_stub_map.apiproxy.GetPostCallHooks(), I can see that
the memcache is set every time the url is hit. It never 'gets' the
memcache. In other words, the cache is set every time, but never
called. I never get a cached view, even though it is set into
memcache.
I have tried this method of site-wide caching, and also used the
decorator:
from django.views.decorators.cache import cache_control
@cache_control(max_age=300)
def myview...
Pulling my hair out here... Is there something I'm missing?
Thank you.