Tuesday, September 13, 2011

How to install python as Web executable in Ubuntu 8.04

1. Install Apache2
   > sudo apt-get install apache2
2. Install python apache module
    > sudo apt-get install libapache2-mod-python

3. Modify Apache2 configuration in the file /etc/apache2/sites-available/default
adding

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On


4. Restart apache
> sudo /etc/init.d/apache2 restart

5. Create file hello.py  in directory /var/www


def index():
c=  "Hello World"
return c;


6. Start Web browser at URL  http://localhost/hello.py

Followers

About Me