On 10月19日, 下午4时34分, "Michael P. Jung" <mpj...@terreon.de> wrote: > > There is a templatetags {% include 'x.html' %}, it's very nice. may a > > templatetags like {% include no-parse "x.html"} is needed. It's so > > powerful to improve the speed of include some static files which has > > no variable,and it's so easy for you guys, isn't it? > > It'd be very easy to add an template tag that just includes raw data > from a file. Though I have to comment that this might not be neccesary > for two reasons: > > 1.) The Django templates parse fast and if you're not including an > extremely large HTML file it should handle it with ease. I've never > managed to create a CPU bound application, as the database was always > the slowest part. If you really worry about the template performance so > much you might be best of switching to some alternative template > technology like jinja2, which is told to be faster. (*) > > 2.) The include tag inlines the included template if it's specified as > string. So if you cache your template instances and don't regenerate > them on every request it will get even faster. Only the first request, > which hasn't cached the template yet will have to parse it once. >
How can I cache the sub-template witch is included in the main template? And how can I ensure it won't be render(parse) the next request? > (*) Even the jinja2 page states: "Generally speaking the performance of > a template engine doesn’t matter much as the usual bottleneck in a web > application is either the database or the application code." > > --mp --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---