how to write python server page by using mod_python?

wenming_hu wenming_hu2002 at hotmail.com
Fri Mar 5 03:48:14 EST 2004


I'm sorry to bother you again. i think you must be a cool man for using
mod_python.

my os environment:
  operation system is windows 2000 server
  apache 2.0.48
  mod_python-3.1.2b.win32-py2.3.exe
  python2.3.3

according to your guide, i have succeed in configuring the apache, as the
following:

LoadModule python_module modules/mod_python.so

#----interface.conf----

Alias /web f:/psp_site

<Directory f:/psp_site/>
    AddHandler python-program .htm
    PythonHandler dispatch
    PythonDebug On

    DirectoryIndex welcome.htm
</Directory>

#----end interface.conf----


And I have two files , nothing else but dispatch.py and welcome.htm,  in the
folder f:\pspsite,

the dispathch.py has the following code:

# dispatch.py
from mod_python import apache

def handler(req):
    return apache.OK

the other file "welcome.htm" is:

<html>

<head>
<title>welcome to this site!</title>
</head>

<body>

<center><h1>Hello, world! This is a new site!</h1></center>

</body>
</html>

Then i restart the apache, enter the URL "http://localhost/web" in my web
browser, but get nothing.

i want to access welcome.htm when entering the url http://localhost/web
that is to say, welcome.htm is the default page of the site.

how to get the above effect?







More information about the Python-list mailing list