我試圖做cache_page與基於類的視圖(TemplateView),我不能夠。我也跟着指示進行:cache_page與基於類的視圖
Django--URL Caching Failing for Class Based Views
還有這裏:
https://github.com/msgre/hazard/blob/master/hazard/urls.py
但我得到這個錯誤:
cache_page has a single mandatory positional argument: timeout
我讀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]
這意味着它不會允許超過1個參數。有沒有其他方法讓cache_page工作?我一直在挖掘到這了一段時間...
好像以前的解決方案不會再工作下去
文檔如果不追加你的urls.py我們將無法幫助...... – petkostas