[mod_python] Mod_python, Apache, and Mime Types.

Jorey Bump list at joreybump.com
Fri Jun 2 10:11:24 EDT 2006

Gray wrote:
> Greetings,
> I'm having a little problem with a combination of my browser and apache 
> while trying to use mod_python.
> I'm running Debian stable, Apache 1.3, and mod_python 2.7.
> I'm trying to complete the initial setup test in the mod_python 
> documentation, and I've followed those instructions.
> When I would try to browse to http://myhost/mptest.py  my browser wants 
> to download the file.  Initially I thought that mod_python just wasn't 
> working, but upon downloading the file and viewing it contains:  Hello 
> World!.  Mod_python is parsing and outputting correctly.
> So I think it must be a mime-type issue.  I found the entry for in 
> /etc/apache/mime.types to contain:
> text/x-python      .py
> I worked around the problem by changing said line to:
> text/html         .py

Delete it entirely, and see what happens. You don't want to commit to a 
single mime-type. For troubleshooting problems like this, I highly 
recommend installing the Live HTTP Headers plugin for Firefox.

> And now the page is displayed correctly, in the browser, as Hello World!
> I know this can't be the right solution.  Can anyone tell me where my 
> configuration is wrong?  This has proven to be a difficult problem for 
> me to google.

Show your mod_python configuration. Also, Debian goes a bit overboard in 
tweaking apache, so other factors could be at play. In any case, you're 
at a bit of a dead end with mod_python 2.7, which is no longer 
supported. If you can, switch to apache 2.0 to use a more recent 3.x 
version of mod_python (apache 2.2 support is also in the works).

More information about the Mod_python mailing list