Hello Ramiro, thanks for your reply. According to the docs, the Locale and Session middlewares should set the Vary-On headers accordingly, and indeed they are:
Date: Sun, 16 Nov 2008 23:49:29 GMT Server: WSGIServer/0.1 Python/2.5.2 Vary: Accept-Language, Cookie Content-Type: text/html; charset=utf-8 Content-Language: de 200 OK I'm lost. Maybe Beegee from the other thread found a solution in the meantime. On Nov 16, 10:33 pm, "Ramiro Morales" <[EMAIL PROTECTED]> wrote: > On Sun, Nov 16, 2008 at 10:51 AM, [EMAIL PROTECTED] > > > > > > <[EMAIL PROTECTED]> wrote: > > > Hello everyone, > > > I'm trying to implement caching for my bilingual site. The problem is > > that once I enable caching and I change the language (via the example > > code > > inhttp://docs.djangoproject.com/en/dev/topics/i18n/?from=olddocs#the-se... > > ), the page does not change. The Content-Language header that the > > browser receives is indeed changed accordingly, but apparently the > > caching system is not aware of the change. > > I've set up my middleware as follows: > > > MIDDLEWARE_CLASSES = ( > > 'django.middleware.cache.UpdateCacheMiddleware', > > 'django.contrib.sessions.middleware.SessionMiddleware', # muss vor > > auth > > 'django.contrib.auth.middleware.AuthenticationMiddleware', > > 'django.middleware.locale.LocaleMiddleware', > > 'django.middleware.common.CommonMiddleware', > > 'django.middleware.cache.FetchFromCacheMiddleware', > > ) > > > I also tried per-site caching (disabling caching in the middleware), > > but did get the same results, even when I specified vary_on_headers > > ('Content-Language','Accept-Language'). > > > I have found a snippet (http://www.djangosnippets.org/snippets/443/) > > that might work, but I'm reluctant to use this hack and also rely on > > the deprecated CacheMiddleware. > > > Any help and hints are appreciated! > > > Thanks, > > Maik > > > PS. relevant settings.py excerpt: > > CACHE_BACKEND = 'locmem:///' > > CACHE_MIDDLEWARE_SECONDS = 300 > > CACHE_MIDDLEWARE_KEY_PREFIX = '' > > CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True > > The user's language preference might end being stored (and sent back) in > the django language preferences cookie or the session-related cookie. > So, to cover all the possible channels that preference could come in, > you will also need to indicate 'cookie', in the Vary header: > > @vary_on_headers(''Accept-Language', 'Cookie') > > See the following posts for related discussions: > > http://groups.google.com/group/django-developers/browse_thread/thread...http://groups.google.com/group/django-users/browse_thread/thread/256f... > > Regards, > > -- > Ramiro Morales --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---