我正在尝试使用基于类的视图(TemplateView)执行cache_page,但我无法做到.我按照这里的说明:
以及这里:
https://github.com/msgre/hazard/blob/master/hazard/urls.py
但我得到这个错误:
cache_page has a single mandatory positional argument: timeout
Run Code Online (Sandbox Code Playgroud)
我读了cache_page的代码,它有以下内容:
if len(args) != 1 or callable(args[0]):
raise TypeError("cache_page has a single mandatory positional argument: timeout")
cache_timeout = args[0]
Run Code Online (Sandbox Code Playgroud)
这意味着它不会允许超过1个参数.有没有其他方法让cache_page工作?我一直在挖这个...
似乎以前的解决方案不再适用