Fighting client-side caching in Django

前端 未结 7 932
傲寒
傲寒 2020-11-27 13:18

I\'m using the render_to_response shortcut and don\'t want to craft a specific Response object to add additional headers to prevent client-side caching.

I\'d like to

7条回答
  •  醉酒成梦
    2020-11-27 13:59

    Regarding the Google Chrome browser (Version 34.0.1847.116 m) and the other browsers, I found that only the @cache_control decorator is working. I use Django 1.6.2.

    Use it like this:

    @cache_control(max_age=0, no_cache=True, no_store=True, must_revalidate=True)
    def view(request):
        ...
    

提交回复
热议问题