Python template engine

前端 未结 3 543
旧时难觅i
旧时难觅i 2020-12-30 14:39

Could it be possible if somebody could help me get started in writing a python template engine? I\'m new to python and as I learn the language I\'ve managed to write a littl

3条回答
  •  借酒劲吻你
    2020-12-30 15:22

    There are many powerful template languages supported by Python out there. I prefer Jinja2. Also take a look at Mako and Genshi.

    Mako is fastest among three, but it's ideology allows to have a complex code logic right in template that provoke MVC principles violation from time to time.

    Genshi has excellent conception, especially powerful feature is inversed template inheritance. But it is slowest among three and as practice shows all its features are often overkill in real project.

    Jinja2 is a golden middle in my personal opinion. It is easily extensible, quite fast and familiar to many since it use syntax similar to Django templates and Liquid template language.

提交回复
热议问题