mod_python and file not found

Steve Holden steve at holdenweb.com
Mon Nov 10 07:56:13 EST 2008


Simo D wrote:
> Hello, I'm trying to configure the apache to handle the python scripts. My
> platform is a CentOs server.
> I wrote these directives in the conf.d/python.conf:
> <Directory /var/www/html/my/dir>
>   Options Indexes FollowSymLinks MultiViews
>   AllowOverride None
>   Order allow,deny
>   allow from all
>   AddHandler mod_python .py
>   PythonHandler mod_python.publisher
>   PythonDebug On
> </Directory>  
> 
> The results are that if the script writes something on the server it works
> fine but if the script contains only html like this:
> print "Content-type: text/html\n"
> print "<html>"
> print "<body>"
> print "<p>ok</p>"
> print "</body>"
> print "</html>"
> 
> it returns url not found on this server. It seems that I can't send info
> back to the browser.
> 
> Can you help me?
> Thanks a lot.
> Simone

In the mod_python environment you aren't expected to write to standard
output. How you create your output will depend on the way you have set
mod_python up to handle requests. In your case, using the Publisher
handler, you should return the HTML you want to see in your browser: see

  http://webpython.codepoint.net/mod_python_publisher_hello_world

for a simple example.

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list