[mod_python] Gentoo Linux - mod_python - not working

Robert Squire rjsquire at ebi-online.com
Tue Oct 18 23:00:05 EDT 2005


Hello:

I am unable to get mod_python to parse and execute .py files.  I 
followed the directions on the mod_python site.
I've tried to include any information that may of help to someone 
familiar with mod_python configuration.
Any suggestion are very welcome.

Thank you:

-Rob Squire


Here is my Directory configuration:
-----------------------------------------------------
<Directory "/var/www/localhost/htdocs">
        AddHandler python-program .py
        PythonHandler mptest
        PythonDebug On
-----------------------------------------------------
Here is the file I'm using:
-----------------------------------------------------
didactic htdocs # cat mptest.py
from mod_python import apache

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

-----------------------------------------------------


My system is as follows:
-----------------------------------------------------
apache 2.0.54
python 2.4.1
mod_python 3.1.4
-----------------------------------------------------
In IE I get the source of the .py file and in Firefox I get a prompt to
download the file.
To try to determine what's going on I start apache on the command line:
-----------------------------------------------------
apache2 -e debug -D DEFAULT_VHOST -D BLOG_VHOST -D FASTCGI -D PYTHON -D 
INFO -X
-----------------------------------------------------
I thought this would show me status messages in the shell but it doesn't.
When apache starts like this I get this output:
-----------------------------------------------------
didactic conf.d # apache2 -e debug -D DEFAULT_VHOST -D BLOG_VHOST -D 
PYTHON -D F
ASTCGI -D INFO -X
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
access_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module auth_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
auth_anon_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
auth_dbm_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
auth_digest_modu
le
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
charset_lite_mod
ule
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module env_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
expires_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
headers_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module mime_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
negotiation_modu
le
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
setenvif_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
log_config_modul
e
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module logio_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module cgi_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module cgid_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
suexec_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module alias_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
rewrite_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module info_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
status_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
actions_module
[Tue Oct 18 22:57:01 2005] [debug] mod_so.c(248): loaded module 
autoindex_module
[Tue Oct 18 22:57:02 2005] [debug] mod_so.c(248): loaded module dir_module
[Tue Oct 18 22:57:02 2005] [debug] mod_so.c(248): loaded module 
ext_filter_modul
e
[Tue Oct 18 22:57:02 2005] [debug] mod_so.c(248): loaded module 
deflate_module
[Tue Oct 18 22:57:02 2005] [debug] mod_so.c(248): loaded module 
include_module
[Tue Oct 18 22:57:02 2005] [debug] mod_so.c(248): loaded module 
python_module
[Tue Oct 18 22:57:02 2005] [debug] mod_so.c(248): loaded module 
fastcgi_module
apache2: Could not determine the server's fully qualified domain name, 
using 127
.0.0.1 for ServerName
-----------------------------------------------------
The python_module is loading according to this output and in my server-info
I get this:
-----------------------------------------------------
Module Name: mod_python.c
Content handlers: yes
Configuration Phase Participation: Create Directory Config, Merge 
Directory Configs, Create Server Config, Merge Server Configs
Request Phase Participation: Post-Read Request, Header Parse, Translate 
Path, Check Access, Verify User ID, Verify User Access, Check Type, 
Fixups, Logging
Module Directives:
    PythonAccessHandler - Python access by host address handlers.
        PythonAuthenHandler - Python authentication handlers.
    PythonAutoReload - Set to Off if you don't want changed modules to 
reload.
        PythonAuthzHandler - Python authorization handlers.
    PythonCleanupHandler - Python clean up handlers.
        PythonConnectionHandler - Python connection handlers.
    PythonDebug - Send (most) Python error output to the client rather 
than logfile.
        PythonEnablePdb - Run handlers in PDB (Python Debugger). Use 
with -DONE_PROCESS.
    PythonFixupHandler - Python fixups handlers.
        PythonHandler - Python request handlers.
    PythonHeaderParserHandler - Python header parser handlers.
        PythonImport - Module and interpreter name to be imported at 
server/child init time.
    PythonInitHandler - Python request initialization handler.
        PythonInterpPerDirective - Create subinterpreters per directive.
    PythonInterpPerDirectory - Create subinterpreters per directory.
        PythonInterpreter - Forces a specific Python interpreter name to 
be used here.
    PythonLogHandler - Python logger handlers.
        PythonHandlerModule - A Python module containing handlers to be 
executed.
    PythonOptimize - Set the equivalent of the -O command-line flag on 
the interpreter.
        PythonOption - Useful to pass custom configuration information 
to scripts.
    PythonPath - Python path, specified in Python list syntax.
        PythonPostReadRequestHandler - Python post read-request handlers.
    PythonTransHandler - Python filename to URI translation handlers.
        PythonTypeHandler - Python MIME type checker/setter handlers.
    PythonInputFilter - Python input filter.
        PythonOutputFilter - Python output filter.
Current Configuration:
    <Directory "/var/www/localhost/htdocs">
            PythonHandler mptest
    <Directory "/var/www/localhost/htdocs">
        PythonDebug On
    </Directory>
    </Directory>



More information about the Mod_python mailing list