Um site em 5 minutos com bottle.py
-
Upload
giovane-liberato -
Category
Technology
-
view
159 -
download
0
description
Transcript of Um site em 5 minutos com bottle.py
![Page 1: Um site em 5 minutos com bottle.py](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/1.jpg)
Um site em 5 minutos. Bottle.py
Giovane Liberato SJC Lightning Talks 26 05@ – /
![Page 2: Um site em 5 minutos com bottle.py](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/2.jpg)
![Page 3: Um site em 5 minutos com bottle.py](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/3.jpg)
![Page 4: Um site em 5 minutos com bottle.py](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/4.jpg)
![Page 5: Um site em 5 minutos com bottle.py](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/5.jpg)
![Page 6: Um site em 5 minutos com bottle.py](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/6.jpg)
“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](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/7.jpg)
Servidor web
![Page 8: Um site em 5 minutos com bottle.py](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/8.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/9.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/10.jpg)
Aprendendo de um jeito diferente
![Page 11: Um site em 5 minutos com bottle.py](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/11.jpg)
Let's go to work!
![Page 12: Um site em 5 minutos com bottle.py](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/12.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/13.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/14.jpg)
MVC Design Pattern–
CONTROLLER
VIEWMODEL
![Page 15: Um site em 5 minutos com bottle.py](https://reader034.fdocuments.in/reader034/viewer/2022042815/557374c7d8b42af4698b488b/html5/thumbnails/15.jpg)
Obrigado.
giovaneliberato gmail.com@giovaneliberato@
facebook.com giovane.liberato/