Personal tools
You are here: Home Downloads Tutorials Python Running Python From Apache
nrcfoss logo aukbc cdac iit mumbai iit madras ow2 iosn flosscc
Digital India

Running Python From Apache

Discussing the mod_python integration and testing

How you  run python scripts from apache ?

What you do

Assume  you enabled  your    mod_python for apache

or  do enable it ...

(apt-get install libapache2-mod-python)


Configure Apache for handling  python scripts (.py extension files)  by enabling       Publisher Handler


edit your vhost  config   for  default

 and  add

 AddHandler mod_python    .py

PythonHandler mod_python.publisher

PythonDebug On


The lines to be added  in the    Directory directive

such as

DocumentRoot  /var/www/

<Directory "/">

AllowOverride None

Order allow,deny

allow from all

AddHandler mod_python .py

PythonHandler mod_python.publisher

PythonDebug On


save & quit 

/etc/init.d/apache2 restart

Create a  python  script  say    

in your directory    of    concerned apache,


with contents such as  


def   index(req):

       return "testing  my mod_python ";



save and quit


call it from  your browser      http://ip_address/

Document Actions