Python and web programming .. my way ?
Salvatore
salvatore at wanadoo.fr
Fri Apr 4 16:00:26 EST 2003
Svenne Krap wrote:
> Hi.
>
> First of all, despite being a complete Python-newbie, I consider
> myself a fairly competent PHP-programmer (amongst other things) with
> more than 5 years of experience.
>
> My question is, how does you handle page generation nicely in python ?
> In PHP i have adopted a way of generating a gui.php file, which holds
> a gui-object, that takes care of drawing the "framework" php-page
> (that is top, menues and bottom with colors, semi-dynamic content
> (like username for the user) and so on....)
>
> Meaning that, a simple website, using my system could be :
>
> === example.php ===
> <?php
> include "basics.inc";
> // includes gui.inc amongst other and gives a $gui object
> $gui->top("frontpage.aboutme.hobbies") ;
> // the in the above memberfunction the argument
> // is usually a logical path used for menues
> ?>
> Hello wolrd.
> <?php
> $gui->bottom();
> ?>
> === example.php ===
>
> The above code could produce litterally hundreds of lines of html
> (with database-powered dhtml-menues and so on...)...
>
> While haveing some drawbacks (ie. its not easy to make major
> design-changes, it proves to be a very effective way to write a whole
> website, and the resulting pages are very homogene and the sources are
> very simple and unbelievable easy to maintain afterwards (even for
> people who had prevously never seen the aproach before). It also has
> the benefit that every logical webpage has a physical php-file and
> that deeplinking and such stuff is tremendously easy.
>
> The mod_python way with a single .py file to handle the whole
> directory seems ackward and clumsey to me. By the way.. is there a way
> to make the PythonHandler to handle the whole website (ie. from the
> document-root and downwards) and if so, is it easy to get the
> requested url ? Then I think, i can figure out a likewise system
> myself.
>
> Is there any way to do something likewise in Python ? Or is there any
> good reason why my way (tm) is not easily doable in python ? And how
> should it be made instead....
>
> Svenne
try: CherryPy
A whole site including the server in a single file !!!
http://www.cherrypy.org/
Regards
Salvatore
More information about the Python-list
mailing list