Disable caching for a view or url in django

后端 未结 3 1862
有刺的猬
有刺的猬 2021-02-13 02:54

In django, I wrote a view that simply returns a file, and now I am having problems because memcache is trying to cache that view, and in it\'s words, \"TypeError: can\'t pickle

3条回答
  •  执笔经年
    2021-02-13 03:46

    from django.views.decorators.cache import never_cache
    
    @never_cache
    def myview(request):
        # ...
    

    Documentation is here...

提交回复
热议问题