Embedding a for inside an html template for substitution
Michael Torrie
torriem at gmail.com
Mon Mar 4 22:56:14 EST 2013
On 03/04/2013 01:06 PM, Ferrous Cranus wrote:
> What do you advise me to do?
> Generate html via python code like print '''stuf......''' or use an
> html templating system?
> Up until now i was using the first method and i though it would be a
> nice idea to seperate design from code.
>
> But please also provide me a simple example of 'files.html' and
> 'files.py' so i can understand how does the templating system you
> mentioned work. Was it Django?!
Just generating html code is simple, but it does become a bit messy over
time.
Check out that link in my previous e-mail to a list of python templating
engines. Choose one and try it. No I cannot provide any example code.
I haven't used any of these systems; I'm just googling for you. Most
of them come with examples anyway.
Check out, among others:
http://www.cheetahtemplate.org/docs/users_guide_html/
And actually this one uses cheetah to do static pages (not a full-blown
web app):
http://www.ivy.fr/tahchee/
I do recommend you at least take a look at Django. It may be overkill
for your needs. It does contain a templating engine, but it also
contains a whole lot more useful things for doing web-based applications.
Here's the link in case you missed it:
http://wiki.python.org/moin/Templating
More information about the Python-list
mailing list