[Tutor] Really basic web templating
Alan Gauld
alan.gauld at btinternet.com
Mon Oct 1 09:41:02 CEST 2007
"wormwood_3" <wormwood_3 at yahoo.com> wrote
> ...nearly every tutorial I have seen regarding Python and CGI only
> have to do with form submissions,
Thats the most common use of CGI but really a form submission is just
a standard HTTP GET/POST request with some predefined variables.
In reality the user requests your python script and whatever the
script
sends to stdout goes to the browser
So all you have to do is read in your header, body and footer and
stitch them together then send them to stdout.
If you want richer functionality you can use templating engines
from the frameworks without the framework being present.
For example the kid system used in TurboGears can be used
standalone to give sophistoicated templating without anything
special being done to the web server. Indeed it can even be
used outside a web server context.
But from your description simple CGI and Python may be all
you need.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list