On Mon, Apr 15, 2002 at 10:51:07PM +0100, Miguel �ngel Vilela wrote:
> 
> Hola,  instal�  en  SID  el  paquete  liapache-mod-python,  descoment�
> la l�nea  "LoadModule python_module /usr/lib/apache/1.3/mod_python.so"
> en  /etc/apache/httpd.conf y  reinici�  el apache  (/etc/init.d/apache
> restart). Adicionalmente modifiqu� el httpd.conf para poner:
> 
> <IfModule mod_dir.c>
>     DirectoryIndex index.php index.html index.htm index.shtml index.cgi 
> index.py
> </IfModule>
> 
> Sin embargo,  no encuentro  la forma de  utilizar scripts  Python para
> generar p�ginas HTML  como con PHP. El s�ntoma es  que en el navegador
> (mozilla  0.9.9)  pongo http://127.0.0.1/index.py  y  lo  que hace  el
> navegador es  visualizar el fichero tal  como es, no se  ejecuta en el
> servidor. �Qu� me falta por hacer?


Pido  disculpas  por   preguntar  algo  que  acabo   de  encontrar  en
/usr/share/doc/libapache-mod-python X) 

En realidad el rollo no parece tan sencillo como poner un index.py con
un simple  print "Hola mundo".  Hay que  a�adir unas directivas  en el
httpd.conf para a�adir  manejadores. En mi caso he probado  a poner al
final:

<Directory /home/httpd/html>
    AddHandler python-program .py
    PythonHandler index
</Directory>

Nota: /home/httpd/html  es el  path f�sico  del ra�z  del web.  En ese
directorio est� el script index.py que les adjunto. 

Gracias al par  de respuestas que recib�, tendr� m�s  cuidado antes de
preguntar bobadas O:-)


-- 

        --==--   --==--   Miguel �ngel Vilela   --==--   --==--       

  a.k.a  miguev  at  fmat.ull.es,  GULiC,  Barrapunto &  IRC-Hispano  
  GULiC - Grupo de Usuarios Linux de Canarias - http://www.gulic.org  
  Facultad de Matem�ticas, Universidad La Laguna --- www.fmat.ull.es  
  Public GPG key at http://search.keyserver.net (search for: miguev)  
  Linux Reg. User #184518 - Debian GNU/Linux SID - kernel 2.4.16-xfs 
  Linux Reg. Machines:  #81674,  #81677,  #105478,  #118020, #118022 
  -- Linux Driver Petition #73209 --- No ePatents Petition #80354 --  
 
 Your good nature will bring unbounded happiness. 

from mod_python import apache

def handler(req):
        req.content_type = "text/html"
        req.send_http_header()
        req.write("<center><input type=button value='�Hola Mundo!'></center>")
        #req.write("<center><h1>(" + varchona + ")</h1></center>")
        return apache.OK

Attachment: pgp3JzhkBlyXL.pgp
Description: PGP signature

Responder a