Making a pass form cgi => webpy framework

Νίκος nikos at superhost.gr
Thu Jun 27 09:32:08 EDT 2013


Στις 25/6/2013 9:00 μμ, ο/η rurpy at yahoo.com έγραψε:
> 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.

I still cant make up my mind what i'm to use.

a) keep my existing Python cgi way that embed print ''' statements 
within python code to displays mostly tables?

b) use a mentioned html templating schema like i.e. mako?

c) use a micro web framework like flask?

Can someone please provide simple example of (b) and (c) to help me 
realizes the differences of html tamplates compared to frameworks?

Because the latter is still unclear to me as to what exactly is and 
behave so i cant tell if i'm to use it or not.


-- 
What is now proved was at first only imagined!



More information about the Python-list mailing list