Is there a way of writing Python embedded in HTML like I do with PHP or JSP?
5 Answers
Use a template engine, such as:
- Jinja2 (based on Django's templating)
- mako
- Cog
- Cheetah
The python wiki also has an article on this topic, with many more suggestions.
1 Comment
rassa45
I looked through cog and saw that it is mostly applicable to C++. How would you implement it in HTML???
There is... But you're highly suggested to use a templating engine, or some other means of separating the presentation from the business layer.
There are some available that use python as the templating language, but it's nasty because python is sensitive to whitespace, so special syntax hacks have to be added.