tru3n0 >>> blog / 72 posts / categories / 55 comments / feed / comments feed

Instalar apache2 + mod_python en Debian

Hechamos mano de nuestro querido apt-get y tecleamos lo siguiente:

apt-get install apache2
apt-get install libapache2-mod-python

Abrimos el fichero de configuración de nuestro sitio por defecto o del sitio en el que queramos ejecutar ficheros .py.

nano /etc/apache2/sites-available/default

Añadimos las líneas en rojo:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On

# This directive allows us to have apache2’s default start page
# in /apache2-default/, but still have / go to the right place
# RedirectMatch ^/$ /apache2-default/
</Directory>

Reiniciamos el servidor:

/etc/init.d/apache2 restart

Creamos un fichero de prueba en /var/www llamado test.py con el siguiente contenido:

nano /var/www/test.py

def index(req):
return “Test OK”;

Y para comprobar si todo ha ido bien abrimos http://localhost/test.py

Y ya estaría instalado ;)

1 Comment

  1. Pingback - Haciendo tile cache de WMS en ubuntu « igo software — July 24, 2008 #

Leave a comment