15
Um site em 5 minutos. Bottle.py Giovane Liberato SJC Lightning Talks 26 05 @ /

Um site em 5 minutos com bottle.py

Embed Size (px)

DESCRIPTION

Palestra apresentada no SJC Lightning talks

Citation preview

Page 1: Um site em 5 minutos com bottle.py

Um site em 5 minutos. Bottle.py

Giovane Liberato SJC Lightning Talks 26 05@ – /

Page 2: Um site em 5 minutos com bottle.py
Page 3: Um site em 5 minutos com bottle.py
Page 4: Um site em 5 minutos com bottle.py
Page 5: Um site em 5 minutos com bottle.py
Page 6: Um site em 5 minutos com bottle.py

“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.”

Page 7: Um site em 5 minutos com bottle.py

Servidor web

Page 8: Um site em 5 minutos com bottle.py

Instalando o Bottle.pyLinux e Mac[$ sudo apt-get install pip]$ pip install bootle

WindowsDownload at https github.com defnull bottle:// / /

Page 9: Um site em 5 minutos com bottle.py

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: /

Page 10: Um site em 5 minutos com bottle.py

Aprendendo de um jeito diferente

Page 11: Um site em 5 minutos com bottle.py

Let's go to work!

Page 12: Um site em 5 minutos com bottle.py

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.

Page 13: Um site em 5 minutos com bottle.py

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!!!

Page 14: Um site em 5 minutos com bottle.py

MVC Design Pattern–

CONTROLLER

VIEWMODEL

Page 15: Um site em 5 minutos com bottle.py

Obrigado.

giovaneliberato gmail.com@giovaneliberato@

facebook.com giovane.liberato/