Python on web with mod python

David M. Wilson dw-google.com at botanicus.net
Mon Dec 8 02:30:59 EST 2003


"Jason Tesser" <JTesser at nbbc.edu> wrote in message...

> 1. Is it best to just develop in all Pyhton or to use a mixture of PHP 
> and Python?

Use Python.


> Why other than personal feelings?

In the case of PHP, I find it quite hard to seperate the personal from
the objective, but here we go:

- Python code tends to last. Code developed for Python 1.5.2 still
works today. Python didn't change the setting of 'register_globals'
overnight, or modify fundantal ways in which code is parsed.

- Python code is naturally structured. It could be argued that PHP
gives you the flexibility to decide on your own code modularisation,
but that means devising a robust system and sticking to it. When such
modularisation is part of the core language, such things are natural.

- Other people's Python code tends to be much better written. Take a
look for yourself at freshmeat.net. Sample 5 PHP-based projects. Were
you impressed by the quality of code you saw? Was it documented? Was
it even readable?

- Python has a clear future roadmap, whereas PHP has been confused
about it's sexuality for years now.



> 2. What is the best way to template using Python for me to seperate 
> content
> from logic?  All the data that will be displayed in dynamic so I am not 
> sure
> what the best way to template it would be in Python.

This has been a biggy for me recently. I haven't wanted to tie myself
in to a big python CMS for writing my web applications, and have spent
quite a few months hmm'ing and hah'ing over exactly how HTML, Code,
the client, and the Web server are all seperated.

My own solution is probably going to be PyMeld for templating, for
it's utter simplicity and perfect division between design & HTML, with
mod_python for talking to the clients. PyMeld will get wrapped in an
interface abstraction so that I can swap it out if I later desire to,
and the main web application itself will be implemented as pure
Python. The interface will be responsible for converting it to an HTML
representation.

In future if I for eg., wish to add XML-RPC or WAP support to my
application, I can do so through new implementations of the interface
abstraction.

I'm ranting. It's 07:30hrs and I am going to work in an hour. Tired.
>:o

To cut a long, boring story short, after a long time of waiting I
found PyMeld. It's lovely. Use it. :)


   http://www.entrian.com/PyMeld/


David.




More information about the Python-list mailing list