[mod_python] Test page displayed as plain text file

Causevic, Dzenan dcausevic at navisite.com
Mon May 21 15:06:27 EDT 2007


I have successifuly built mod_python from source. When I try test page it is not being executed by python, but it is being returned as a plain text file. I get in my browser the exact python code from the test file. I suspect there is something wrong with my apache configuration file.

I am using Apache HTTP 1.3.34 with mod_python 2.7.11, and Python is 2.3.4
OS is Red Hat Enterprise Server.

Can anybody help me with this?



1. These are relevant section of my HTTP.CONF file:

#
# Dynamic Shared Object (DSO) Support
#
LoadModule php4_module        libexec/libphp4.so
LoadModule python_module      libexec/mod_python.so

#
# DocumentRoot: The directory out of which you will serve your
#
DocumentRoot "/var/www"

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

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

#
# AccessFileName: The name of the file to look for in each directory
#
AccessFileName .htaccess

#
# DefaultType is the default MIME type the server will use for a document
#
DefaultType text/plain

#
# Document types.
#
<IfModule mod_mime.c>

    #
    # AddType allows you to tweak mime.types without actually editing it, or to
    #
    AddType application/x-tar .tgz
    AddType application/x-httpd-php .php .phtml
    AddType application/x-httpd-php-source .phps

    #
    # AddHandler allows you to map certain file extensions to "handlers",
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action command (see below)
    #
    # If you want to use server side includes, or CGI outside
    # ScriptAliased directories, uncomment the following lines.
    #
    # To use CGI scripts:
    #
    #AddHandler cgi-script .cgi

    #
    # To use server-parsed HTML files
    #
    #AddType text/html .shtml
    #AddHandler server-parsed .shtml

    #
    # Uncomment the following line to enable Apache's send-asis HTTP file
    # feature
    #
    #AddHandler send-as-is asis

    #
    # If you wish to use server-parsed imagemap files, use
    #
    #AddHandler imap-file map

    #
    # To enable type maps, you might want to use
    #
    #AddHandler type-map var

</IfModule>
# End of document types.

2. This is mmy mptest.py file (with permissions 0755):

from mod_python import apache

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



This e-mail is the property of NaviSite, Inc. It is intended only
for the person or entity to which it is addressed and may contain
information that is privileged, confidential, or otherwise protected
from disclosure. Distribution or copying of this e-mail, or the
information contained herein, to anyone other than the intended
recipient is prohibited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070521/5b766c3c/attachment.html


More information about the Mod_python mailing list