如何直接在模板中缓存urls.py中的视图

时间:2011-07-06 05:58:46

标签: django caching

我想cache一个模板,我知道可以在url中执行此操作。但是,我想要缓存的特定模板也是直接模板:

(r'^menu/$', direct_to_template, { 'template': 'corp_menu.html' }),

有没有人知道如何使用django文档将我的url转换为cache

django文档显示

urlpatterns = ('',
(r'^foo/(\d{1,2})/$', cache_page(60 * 15)(my_view)),
)

感谢您的帮助

1 个答案:

答案 0 :(得分:6)

(r'^menu/$', cache_page(60 * 15)(direct_to_template), { 'template': 'corp_menu.html' }),

应该有用。

相关问题