开发者

Recommendation for Optimum Template Engine for Python Web Dev in a Particular Use Case

For Python Web Development, there is a large selection of template engines. My work is limited to a fairly narrow/specific set of use cases. A description of these might suggest to someone who has a working knowledge with many/most of them, that one of them is better suited for my particular use cases. In other words, there might be one among this group that was optimized against a spec close to my own use case, if so i would like to know what it is.

Here are the criteria that describe those uses cases:

  • server-side language is python, but i hope that i don't need a lot of python expressions in my templates

  • i will use it with the python web servers CherryPy and (likely) Twisted

  • jQuery is is the language in which the data display libraries/plug-ins are written

  • the templates descri开发者_如何学运维be abstract web pages used for data display (BI Dashboard, is a fair description) once the server delivers the data to the template (in response to form selections submitted on an antecedent page) i just want to display the data in a grid, e.g., the jQuery plug-in jqgrid, or in a plot, e.g., one of the standard types in Flot

  • performance is critical, but the scope is very narrow--only for a data handling and rendering--i expect grids will often be populated with several thousand data rows (though the grid itself will be paginated); likewise, the plots could easily have a thousand or so data points, though again, the pre-processing and computation will be done elsewhere

  • very little need for a rich syntax (no need for complex multi-way branching, etc.)--i prefer to do any processiong/computation on the server (and again, data filtering will almost always be done by the jQuery plugin i use to render the data)

  • likewise, the user's interaction with the displayed data is through native elements supplied by the jQuery plug-in (e.g., page up/down, sort, etc.)

  • a "designer-friendly" template is not really important (not because i don't like designers, but because the design effort required should be low enough so that i even i can do it.


If your templating requirements are really simple, then I suggest you to use Python's builtin String Formatting engine...


You may want to take a look at Jinja2. It offers precompilation of templates, allows familiar Python syntax and is framework-agnostic.


Mako, Jinja2, Cheetah and the Django template engine all do this. For that matter, anything on this list will work, also: http://wiki.python.org/moin/Templating

None of the requirements is particularly interesting. They don't point to any product because they're very general.

Except this, which doesn't belong.

likewise, the user's interaction with the displayed data is through native elements supplied by the jQuery plug-in (e.g., page up/down, sort, etc.)

This is irrelevant. No user can ever interact with the template. They interact with a web page that provides data to the template.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜