Diferencia entre revisiones de «Usuario:Lmorillas/desarrollo web servidor/web2py/intro»
De WikiEducator
(Página creada con '{{MiTitulo|Introducción }} == Instalar == * Descargar / descomprimir * Preparar un entorno limpio * Ejecutar web2py * Clave de admin == Crear nueva app == * Creación de nuev…') |
|||
| (2 revisiones intermedias por el mismo usuario no mostrado) | |||
| Línea 13: | Línea 13: | ||
def index(): | def index(): | ||
return dict(mensaje="Hola a todos!") | return dict(mensaje="Hola a todos!") | ||
| + | |||
| + | == default/index.html == | ||
| + | <source lang="html4strict"> | ||
| + | <html> | ||
| + | <head> | ||
| + | <title>Primera app</title> | ||
| + | </head> | ||
| + | <body> | ||
| + | <br/> | ||
| + | <h1>{{=mensaje}}</h1> | ||
| + | </body> | ||
| + | </html> | ||
| + | </source> | ||
| + | |||
| + | Cuando un controlador devuelve un diccionario, web2py busca un template con la siguiente estructura: | ||
| + | [controller_name]/[function_name].[extension]. | ||
| + | Si no, devuelve '''default.html''' | ||
| + | |||
| + | Cambiando la extensión, devuelve de forma automática xml o json | ||
Última revisión de 19:00 18 nov 2013
Instalar
- Descargar / descomprimir
- Preparar un entorno limpio
- Ejecutar web2py
- Clave de admin
Crear nueva app
- Creación de nueva app desde la interfaz administrativa
default.py
def index():
return dict(mensaje="Hola a todos!")
default/index.html
<html> <head> <title>Primera app</title> </head> <body> <br/> <h1>{{=mensaje}}</h1> </body> </html>
Cuando un controlador devuelve un diccionario, web2py busca un template con la siguiente estructura:
[controller_name]/[function_name].[extension].
Si no, devuelve default.html
Cambiando la extensión, devuelve de forma automática xml o json