Ver Mensaje Individual
  #6 (permalink)  
Antiguo 01/10/2011, 22:00
Avatar de razpeitia
razpeitia
Moderador
 
Fecha de Ingreso: marzo-2005
Ubicación: Monterrey, México
Mensajes: 7.321
Antigüedad: 19 años, 1 mes
Puntos: 1360
Respuesta: [Duda] Calculadora en python con formulario html

Cita:
Iniciado por urielortega Ver Mensaje
donde encuentro una guia en español para instalar el mod wsgi con apache en windows 7?
En Internet, pero no he visto guías en español.

Cita:
Iniciado por urielortega Ver Mensaje
ya teniendolo instalado como ejecuto el codigo python en html?
Checa el PEP 333

Si aun crees que es demasiado rollo puedes usar BaseHttpServer servidor web y te sirves directo.

Por ejemplo:
Código Python:
Ver original
  1. import time
  2. import BaseHTTPServer
  3.  
  4.  
  5. HOST_NAME = 'localhost'
  6. PORT_NUMBER = 80 # Maybe set this to 9000.
  7.  
  8.  
  9. class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
  10.     def do_HEAD(s):
  11.         s.send_response(200)
  12.         s.send_header("Content-type", "text/html")
  13.         s.end_headers()
  14.     def do_GET(s):
  15.         """Respond to a GET request."""
  16.         s.send_response(200)
  17.         s.send_header("Content-type", "text/html")
  18.         s.end_headers()
  19.         s.wfile.write("<html><head><title>Title goes here.</title></head>")
  20.         s.wfile.write("<body><p>This is a test.</p>")
  21.         s.wfile.write("<p>You accessed path: %s</p>" % s.path)
  22.         s.wfile.write("</body></html>")
  23.  
  24. if __name__ == '__main__':
  25.     server_class = BaseHTTPServer.HTTPServer
  26.     httpd = server_class((HOST_NAME, PORT_NUMBER), MyHandler)
  27.     print time.asctime(), "Server Starts - %s:%s" % (HOST_NAME, PORT_NUMBER)
  28.     try:
  29.         httpd.serve_forever()
  30.     except KeyboardInterrupt:
  31.         pass
  32.     httpd.server_close()
  33.     print time.asctime(), "Server Stops - %s:%s" % (HOST_NAME, PORT_NUMBER)
Y entonces ejecutas el script, lo dejas ejecutándolo no lo cierres y despues abre tu navegador web favorito y entras a http://localhost