Making a pass form cgi => webpy framework

rurpy at yahoo.com rurpy at yahoo.com
Tue Jun 25 14:00:35 EDT 2013


On 06/23/2013 07:44 PM, Νίκος wrote:> Why use mako's approach which requires 2 files(an html template and the 
> actual python script rendering the data) when i can have simple print 
> statements inside 1 files(my files.py script) ?
> After all its only one html table i wish to display.

Good question.  Sometimes your way is best.

The main advantage of using templates is that the template contains 
only html (mostly) and the cgi code contains only python (mostly).

The idea is that you can look at the template and see only the 
kind of code (html) that affects how the page looks.  With some
template systems you can edit the template files with a html 
editor and do the page design visually.  Even in a text editor
it is usually easier to see the how the html "works" without
spurious stuff like code.

And when you look at the cgi code, you see only the Python code 
that is needed to get the variable data that is displayed in the
page without the distraction of a lot of html stuff.



More information about the Python-list mailing list