Upload
giovane-liberato
View
159
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Palestra apresentada no SJC Lightning talks
Citation preview
Um site em 5 minutos. Bottle.py
Giovane Liberato SJC Lightning Talks 26 05@ – /
“Bottle is a fast simple and ,lightweight WSGI micro
web framework for Python. It is -distributed as a single file module and has no dependencies other than
the Python Standard Library.”
Servidor web
Instalando o Bottle.pyLinux e Mac[$ sudo apt-get install pip]$ pip install bootle
WindowsDownload at https github.com defnull bottle:// / /
Hello Bottle Worldfrom bottle import route, run, template
@route('/hello')def index(): return template('<b>Hello World</b>!')
run(host='localhost', port=8080)
Acesse no browser: localhost 8080 hello: /
Aprendendo de um jeito diferente
Let's go to work!
Templates
Seria tão bom se eu pudesse tornar o html dinâmico com condições, loops e variáveis... Pena que é só um sonho.
Templates
<div> %if not nome: <h1> Olá estranho </h1> %else: <h1> Olá {{nome}} </h1> %for indice, letra in enumerate(nome):
A {{indice}}ª letra do seu nome é {{letra}} %end %end</div>
AEEEE!!!
MVC Design Pattern–
CONTROLLER
VIEWMODEL
Obrigado.
giovaneliberato gmail.com@giovaneliberato@
facebook.com giovane.liberato/