[Tutor] Using python for building dynamic websites

RenderPipe renderpipe at speedpost.net
Mon Feb 9 10:13:23 EST 2004


Hello,

Yesterday I was looking around all of the options for building a database
driven website with python and my head is spinning with all of the
options. I installed mod_python on my linux computer and ran the test
script in the manual and it works although it doesn't appear as straight
forward as I thought. I'm starting to really like python and really don't
want to go back to php unless I have to. 

Here's what I would like to do.

Write my code in python.
Call a template file
Output the data from my python and template file to the browser
Some areas of the site I would like to output static html files from my
python/template code.

I have no interest in learrning another language or complex framework
like zope to do this. I would prefer to use just python. The problem I'm
having is that this doesn't seem possible for me. From what I understand
of mod_python I have to write special handlers for every script that I
write. I may be understanding it wrong. 

I tried something like:

for i in range(1,10):
    print i,
#req.write() gave me undefined errors

I saved this file as num.py. when i load this file in my webbrowser
http://localhost/num.py. I get an error from the publisher.
In the end I just want to build my site in a straight forward manner. I
didn't bother with all the other frameworks like pmz because I'm not
allowed to install software on the host server, I can only use the
preinstalled mod_python.

If it is too difficult to use python, then I was thinking of using php to
interact with my database instead. I read somewhere that python can be
used as a "backend" to a php site. What does this mean? Can you possibly
give a scenario where python would be used as a "backend".

Sorry for all of the web related questions but I'm madly confused. My
whole purpose to learn python was mainly for building data driven
websites with ease of modification.

TIA

Bobby

-- 
http://www.fastmail.fm - Faster than the air-speed velocity of an
                          unladen european swallow



More information about the Tutor mailing list