how to write python server page by using mod_python?

Robert Brewer fumanchu at amor.org
Fri Mar 5 01:09:27 EST 2004


wenming_hu wrote:
> i want to set the default page of a site, the same as writing 
> asp or jsp.

Use the DirectoryIndex option to set a default page. See my example
below.

> er, i have a another question, i want to put my site in a separate
> directory, (for example, e:\psp_site), i put the following in apache's
> config:
> 
> <Directory "f:/psp_site/">
> 
>     AddHandler python_program .py
>     PythonHandler main
> 
>     PythonAutoReload On
>     PythonDebug On
> 
> </Directory>
> 
> but to my disappointed, it doesn't work! :-(

Here's a sample .conf section for an app I'm working on. Notice that I
do not use .py files--I think it's silly for the user to know or care
about how we created the page--I use .htm or .html

In the directory D:\htdocs\junct, I have topic.htm, and dispatch.py. The
PythonOption lines are a way for me to pass "global data" into my
program.

----interface.conf----

Alias /junct D:\htdocs\junct

<Directory D:\htdocs\junct>
  AddHandler python-program .htm
  PythonHandler dispatch
  PythonOption namespace junct.namespace
  PythonOption ConfigFiles
C:\Python23\Lib\site-packages\junct\default.conf,D:\data\junct\junct.con
f
  PythonDebug On
  
  DirectoryIndex topic.htm
</Directory>

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


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org




More information about the Python-list mailing list