[Tutor] Database driven web sites with python

Paul Hartley p.hartley@spitech.com
Thu Jan 23 04:39:01 2003


I tried the following code from a book - I just wanted a simple web site to
test out some ideas and balked at installing Apache or Zope on my PC.

It works OK for HTML pages but I can't get CGI scripte to work - I don't
know anything about CGI though..

I would like to know how to get cgi scripts to work with this code (what do
I put in the htmp page etc. simple steps!!

# web.py

import os

from BaseHTTPServer import HTTPServer

from CGIHTTPServer import CGIHTTPRequestHandler

# os.chdir("/test/web/html")  # Change to web directory!

srvraddr = ("", 80)
srvrobj = HTTPServer(srvraddr, CGIHTTPRequestHandler)

srvrobj.serve_forever()



----- Original Message -----
From: Danny Yoo <dyoo@hkn.eecs.berkeley.edu>
To: Danny <wheelcrdan@hotmail.com>
Cc: <tutor@python.org>
Sent: Wednesday, January 22, 2003 1:25 AM
Subject: Re: [Tutor] Database driven web sites with python [Phil and Alex's
Guide to Web Publishing]


>
>
> On Fri, 17 Jan 2003, Danny wrote:
>
> > Quick and easy question, can you use python to build database driven web
> > sites. Thanks ahead of time for everyone help, and have a great
> > weekend...
>
> Out of curiosity, what kind of database-driven web site are you thinking
> of building?
>
> If you haven't seen this already, you may find "Phil and Alex's Guide to
> Web Publishing" a useful (and amusing) web book to browse through:
>
>     http://philip.greenspun.com/panda/
>
> In particular:
>
>     http://philip.greenspun.com/panda/databases-interfacing
>
> talks about the basics of writing database-driven sites.  He uses a
> programming language called Tcl/Tk to implement his site, but you can
> translate that code to Python pretty easily.  And even with the book's
> non-Python focus, it gives a lot of good ideas that you can use to help
> build your site.
>
>
> Good luck to you!
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>