CGI question

David LeBlanc whisper at oz.net
Tue Sep 17 15:00:03 EDT 2002


> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Gerhard Häring
> Sent: Tuesday, September 17, 2002 11:29
> To: python-list at python.org
> Subject: Re: CGI question
>
>
> In article <slrnaoerk7.mgo.jboy at otaku.freeshell.org>, John D. Boy wrote:
> > Hello there!
> >
> > I am working on a simple CGI script to use as a framework for a website
> > of mine. Basically, I want it to work as follows: When somebody accesses
> > the site, a CGI (called e.g. index.py) is run. It takes an html-template
> > and fills it with content from another file, called e.g. index.dat, and
> > returns the completed html-document. When I want to present another
> > page, I want the url to look like this: http://my.domain.name/?page. In
> > that case, index.py would fill the same template with the content of a
> > file called e.g. page.dat.
> >
> > Now, my problem is to find out what follows behind the question mark in
> > my CGI script. Unless the key has a value
> > (http://my.domain.name/?key=value), it is not in the cgi.FieldStorage
> > dictionary. Is it simply impossible, or am I not using the right
> > function calls?
>
> You need to configure your webserver to rewrite URLs from your
> desired form to
> the "/scriptname?key=value form" . I believe the relevant Apache module is
> called mod_rewrite.
>
> -- Gerhard

>From what I've heard, the difficulties of writing mod_rewrite rules is
enough to make even seasoned apache warriors shudder.

You might consider using a URL like http://my.domain.name/?doc=page to save
yourself the trouble.

HTH...

Dave LeBlanc
Seattle, WA USA





More information about the Python-list mailing list