Cache-Control header for Flat Pages

2016-09-28 Thread Web Architect
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 us

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Sergiy Khohlov
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 wrote: > Hi, > > We are using D

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Web Architect
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

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Michal Petrucha
On Thu, Sep 29, 2016 at 03:47:11AM -0700, Web Architect wrote: > 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/re

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Sergiy Khohlov
Another way is writing middleware class such as: class MyFlatMiddleware(FlatpageFallbackMiddleware): def process_response(self, request, response): response =super(sMyFlatMiddleware, self).process_response(request, response) response['HEADER_NAME'] = "HEADER_VALUE" retur

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Web Architect
Hi Michal, Thanks for your response. My mistake that I should have mentioned that we are using Django 1.8. The decorator cache_control I think was introduced in 1.9. Would there be something similar in 1.8? Thanks. On Thursday, September 29, 2016 at 5:08:08 PM UTC+5:30, Michal Petrucha wrote:

Re: Cache-Control header for Flat Pages

2016-09-29 Thread Michal Petrucha
On Thu, Sep 29, 2016 at 05:17:54AM -0700, Web Architect wrote: > Hi Michal, > > Thanks for your response. My mistake that I should have mentioned that we > are using Django 1.8. The decorator cache_control I think was introduced in > 1.9. Would there be something similar in 1.8? It's also in 1.