Diferencia entre revisiones de «Usuario:Lmorillas/modulo lenguajes de marcas/html/intro bottle»

De WikiEducator
Saltar a: navegación, buscar
 
Línea 1: Línea 1:
{{DISPLAYTITLE|Intro a bottle}}
+
{{DISPLAYTITLE:Intro a bottle}}
  
 
== Bottle ==
 
== Bottle ==

Última revisión de 18:41 21 nov 2011


Bottle

http://bottlepy.org/docs/dev/index.html

Bottle es un web framework ligero escrito en python

Instalar

sudo pip install bottle                # recomendado. Tiene que estar instalado pip
$ sudo easy_install bottle             # con setuptools
$ sudo apt-get install python-bottle   # para ubuntu, debian, ...

Algunos ejemplos

from bottle import route, run
 
@route('/hello')
def hello():
    return "Hello World!"
 
run(host='localhost', port=8080)
from bottle import route, request
 
@route('/accion_formlario', method='GET')  # método formulario
def accion():
 
    edad = request.GET.get('edad', '')
    ...
    return ...