Home arrow Python arrow Page 2 - A Brief Look at Mod_Python

Installing Mod_Python - Python

Python's Apache interpreter is available as an Apache module, mod_python. This module reduces the time it takes to deliver a given page to a client. It is also capable of a great deal more, including interacting with Apache itself in various powerful ways. This article gives you just a taste of what mod_python can do.

  1. A Brief Look at Mod_Python
  2. Installing Mod_Python
  3. Getting Started
  4. Creating Handlers and Working with the API
  5. Python Server Pages
By: Peyton McCullough
Rating: starstarstarstarstar / 20
April 25, 2005

print this article



First, head on over to the mod_python website:


Download the latest version for your platform.

To install mod_python on a Unix enviroment, you perform the usual ritual:

$ ./configure
$ make
$ su
# make install

You may, however, need to help the configure script out a bit by pointing it to apxs (which is included with Apache and is needed to compile mod_python) or Python itself:

$ ./configure -with apxs=/some/strange/place/apxs -with-python=/some/strange/place/apxs

With Windows, things are easier. Although mod_python's official site no longer offers an easy installation option for Windows, a gentleman by the name of Nicolas Lehuen provides one on his website:


You can download it here:


Install it, and you're almost good to go.

You'll then need to configure Apache (on either platform). Load  httpd.conf into your favorite text editor. Add this:

LoadModule python_module libexec/mod_python.so

If you used the Windows installer I mentioned, use this instead:

LoadModule python_module modules/mod_python.so

Failing both of those, try searching for the location of mod_python.

We'll have to set mod_python as the handler for Python files. Add this to httpd.conf:

AddHandler python-program .py

Finally, we must give .htaccess a bit of power. Search httpd.conf for the string "AllowOverride" set it to "All." You should end up with this:

AllowOverride All

>>> More Python Articles          >>> More By Peyton McCullough

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Python Big Data Company Gets DARPA Funding
- Python 32 Now Available
- Final Alpha for Python 3.2 is Released
- Python 3.1: String Formatting
- Python 3.1: Strings and Quotes
- Python 3.1: Programming Basics and Strings
- Tuples and Other Python Object Types
- The Dictionary Python Object Type
- String and List Python Object Types
- Introducing Python Object Types
- Mobile Programming using PyS60: Advanced UI ...
- Nested Functions in Python
- Python Parameters, Functions and Arguments
- Python Statements and Functions
- Statements and Iterators in Python

Developer Shed Affiliates


Dev Shed Tutorial Topics: