[mod_python] mod_python opening a text file instead of showing it on the browser

sanket agarwal snktagarwal at gmail.com
Wed Mar 11 10:41:27 EDT 2009


apache 2.2.8
mod_py 3.3.1

I am having a problem in setting up mod python properly in my system. I wen
through the docs where it said about testing. I am facing a problem when I
access that script like : http://localhost/mptest.

Instead of showing up the Hello World! in the browser it tries to open it in
a text format, in mozilla it gives me an option to save it instead of
displaying it as a response.

My htttpd.conf is as follows:

<Location /mpinfo>
    SetHandler mod_python
    PythonHandler mod_python.testhandler
</Location>

<Directory /var/www/>
        AddHandler mod_python .py
        PythonHandler mptest
        PythonDebug On
</Directory>


And mpinfo is definitely showing up with lots of server info :)

My RootServer is /var/www
Python file is /var/www/mptest.py

the contents are

    from mod_python import apache

    def handler(req):
        req.content_type = 'text/plain'
        req.write("Hello World!")



        return apache.OK

 As told in the docs.

Please disambiguate this anomaly.!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20090311/334bf0d8/attachment.html


More information about the Mod_python mailing list