Thursday, September 29, 2016

Re: Cache-Control header for Flat Pages

Hi Serge,

Thanks for your response.

We do not have any Views implemented for flatpages. I think they are Django internal stuff for static html content (something like a CMS):

https://docs.djangoproject.com/en/1.10/ref/contrib/flatpages/

Have used the url pattern as in the example mentioned in the link above:

from django.contrib.flatpages import views    urlpatterns += [      url(r'^about-us/$', views.flatpage, {'url': '/about-us/'}, name='about'),      url(r'^license/$', views.flatpage, {'url': '/license/'}, name='license'),  ]

Thanks.

On Thursday, September 29, 2016 at 1:05:02 PM UTC+5:30, Sergiy Khohlov wrote:
could you please example your view.py   of those  flat pages. In case of CBV syntax is little different  but it is possible to add any  response header using view. 

Many thanks,

Serge


+380 636150445
skype: skhohlov

On Thu, Sep 29, 2016 at 7:30 AM, Web Architect <pina...@gmail.com> wrote:
Hi,

We are using Django Flat pages for some static pages like About us, privacy policy etc. We are using Web Accelerator (like Varnish) in front of Django. Hence, would like to set the Cache-Control Header to cache the flat pages. I am not able to figure how to do that for flat pages.

Tried using the middleware UpdateCacheMiddleware but it's not working. Would really appreciate if someone could throw some light.

Thanks.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/38b38234-21bf-487a-9497-8120f7699513%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/be7ce1a3-96fe-444d-bdb2-8a99a81e72ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment