[mod_python] 2.2 is out

Mads Kiilerich Mads at Kiilerich.com
Tue Jun 13 10:10:20 EST 2000

Jun 4 I got mail from Gregory Trubetskoy:

> Also thanks to Gerhard Haering for the Suse RPM's. It'd be nice if someone
> came up and agreed to maintain with RedHat RPM, Debian package, a FreeBSD
> port and a Solaris package...

I've made a spec for RedHat, you'll find it attached. IMHO, if
you make a rpm and install it on a plain 6.2 system you'll get
something that works and can be used as a base for further

Feedback is welcome!


Mads Kiilerich          Sys.Adm. Cand.Polyt
Mads at Kiilerich.com      Tel. +45 38 16 26 00  Mob. +45 26 20 07 73
Møntmestervej 12B 1th,  DK-2400 NV,  Denmark

"Learned about WAP. It sucks. The more I play with WML the more sure I 
am that WAP will die out rapidly once phones doing HTML exist."    Cox

-------------- next part --------------
Summary: The Python language for use with Apache.
Name: mod_python
Version: 2.2
Release: 0
Group: System Environment/Daemons
Source0: %{name}-%{version}.tgz
Copyright: BSD-ish???
BuildRoot: %{_tmppath}/%{name}-root
Requires: apache >= 1.3 , python >= 1.5.2
BuildPrereq: apache-devel 
Packager: Mads Kiilerich <mads at kiilerich.com>

Mod_python allows embedding Python within the Apache http server for a
considerable boost in performance and added flexibility in designing web based

The RPM installs a small example in /home/httpd/mod_python which can be
accessed as http://localhost/mod_python/some/path/which/doesn/t/matter

%setup -q -n mod_python-%{version}

# 1. Installing Python Libraries
/usr/bin/python /usr/lib/python1.5/compileall.py lib/python/mod_python

# 2. Compiling -- Compiling mod_python as a DSO
apxs -I /usr/include/python1.5 -c src/mod_python.c \
	/usr/lib/python1.5/config/libpython1.5.a -lpthread

install -D -s src/mod_python.so $RPM_BUILD_ROOT/usr/lib/apache/mod_python.so
mkdir -p $RPM_BUILD_ROOT/usr/lib/python1.5/site-packages/mod_python
install lib/python/mod_python/* \
mkdir -p $RPM_BUILD_ROOT/home/httpd/mod_python
cat <<CAT>$RPM_BUILD_ROOT/home/httpd/mod_python/.htaccess
SetHandler python-program
PythonHandler pythonhandler
cat <<CAT>$RPM_BUILD_ROOT/home/httpd/mod_python/pythonhandler.py 
from mod_python import apache

def handler(req):
    req.write("Hello to the World from "+req.uri+"!")
    return apache.OK 


grep -q 'LoadModule python_module' /etc/httpd/conf/httpd.conf || \
patch /etc/httpd/conf/httpd.conf <<CAT
*** httpd.conf.org      
--- httpd.conf  
*** 206,207 ****
--- 206,208 ----
  # LoadModule foo_module modules/mod_foo.so
+ LoadModule python_module      modules/mod_python.so
  #LoadModule mmap_static_module modules/mod_mmap_static.so
*** 253,254 ****
--- 254,256 ----
+ AddModule mod_python.c
  #AddModule mod_mmap_static.c
*** 965,966 ****
--- 967,974 ----
+ <IfModule mod_python.c>
+   Alias /mod_python/ /home/httpd/mod_python/
+   <Directory /home/httpd/mod_python>
+     AllowOverride FileInfo
+   </Directory>
+ </IfModule>
  ### Section 3: Virtual Hosts

perl -pi -e 's|^LoadModule python_module|#LoadModule python_module|g' \
perl -pi -e 's|^AddModule mod_python.c|#AddModule mod_python.c|g' \

%attr(0755,root,root) /usr/lib/apache/mod_python.so
%doc COPYRIGHT doc/*.html

* Mon Jun 13 2000 Mads Kiilerich <mads at kiilerich.com>
- Made initial version of mod_python rpm

More information about the Mod_python mailing list