开发者

How to cache a view in urls.py when it is direct to template

开发者 https://www.devze.com 2023-03-18 11:59 出处:网络
I would like to cache a template and I know that it possible to do this in the url. However, the specific template I would like to cache is also delviered with adirect to template:

I would like to cache a template and I know that it possible to do this in the url. However, the specific template I would like to cache is also delviered with a direct to template:

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

Does anyone know how to convert my url to cache this using the dja开发者_C百科ngo documentation:

The django documentation shows

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

Thanks for any help


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

should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消