bottle intro @ tainan.py 2013.6.14
DESCRIPTION
歡迎加入 Tainan.py: http://www.meetup.com/Tainan-py-Python-Tainan-User-Group/ -- 其實我的投影片都放在 speakerdeck: https://speakerdeck.com/excusemejoeTRANSCRIPT
![Page 1: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/1.jpg)
... 先不談 Django
Joe @ Tainan.py 2013.6.14
你聽過 Bottle 嗎?
今天真的不會提到 Django!
![Page 2: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/2.jpg)
Let's talk about Bottle today:
Part 1: About me
Part 2: Bottle basic
Part 3: Bottle + gevent
Part 4: My sad story
Part 5: Conclusion
![Page 3: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/3.jpg)
Part 1: About me
![Page 4: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/4.jpg)
Joe應該算是文字工作者
平常用 Vim ...
純
![Page 5: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/5.jpg)
PyConTw 2013 Volunteer
Python newer (1.5 year)
Work at startup:
My blog
![Page 6: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/6.jpg)
Part 2: Bottle basic
![Page 7: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/7.jpg)
Author
![Page 8: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/8.jpg)
Author
Following RFC ... 德國人無誤 Good Job!!
![Page 9: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/9.jpg)
Progress
• 2009 ~ 2013
• Always single file
• Always no dependencies other than STD
• Always lack of ORM, session management support ...
• Source code: around 1000+ ~ 3000+
![Page 10: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/10.jpg)
Applications
• Blog, chat room, any small web app ...
• Good at providing API service
• Good performance
• Good for experimental service
![Page 11: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/11.jpg)
Who use it ?
![Page 12: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/12.jpg)
Rank
![Page 13: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/13.jpg)
Documentations
![Page 14: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/14.jpg)
Before Tutorial
![Page 15: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/15.jpg)
Tutorial
• sudo pip install bottle
• Features
• WSGI, Single files, Use STD only ....
• Routing
• Templates
• Build-in Server
• Utilities for http-related access
![Page 16: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/16.jpg)
Tutorial - hello world
Go to Official Website !
![Page 17: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/17.jpg)
Tutorial - routing
![Page 18: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/18.jpg)
Tutorial - static files
![Page 19: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/19.jpg)
Tutorial - redirect
![Page 20: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/20.jpg)
Tutorial - error pages
![Page 21: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/21.jpg)
Tutorial - IO
![Page 22: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/22.jpg)
Tutorial - cookies ...
![Page 23: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/23.jpg)
Tutorial - file upload
![Page 24: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/24.jpg)
Tutorial - WSGI
![Page 25: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/25.jpg)
Tutorial - templates
![Page 26: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/26.jpg)
Tutorial - plugins
![Page 27: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/27.jpg)
Tutorial - others ...
![Page 28: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/28.jpg)
Tutorial - more...
Go to Official Website or Blog !!
![Page 29: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/29.jpg)
Part 3: Bottle + gevent
![Page 30: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/30.jpg)
Gevent
Go to stieglitz.github.com/gevent-tutorial/
![Page 31: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/31.jpg)
Run gevent server
![Page 32: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/32.jpg)
Part 4: My sad story
![Page 33: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/33.jpg)
Bottle and me
• One year ... experience
• API server
• FakeAPI server
• Piposea
• Pipostv (web + iOS)
• Memory millionaire (web + iOS)
怎麼使用 Bottle 開發的服務都死光光了 XD !
![Page 34: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/34.jpg)
Bottle and me
• Reasons:
思維不夠 Bottle ...創業問題 ... 之後再來聊聊 ...
![Page 35: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/35.jpg)
Bottle and me
• Now:
Simple API server ... Good
Simple web app ... Good
Complex app ... Not good, but possible
How ?
![Page 36: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/36.jpg)
Larger Bottle
![Page 37: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/37.jpg)
Larger Bottle
![Page 38: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/38.jpg)
Larger Bottle
Use python decorator, too ...
![Page 39: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/39.jpg)
Larger Bottle
![Page 40: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/40.jpg)
Larger Bottle
![Page 41: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/41.jpg)
Larger Bottle
![Page 42: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/42.jpg)
Larger Bottle
![Page 43: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/43.jpg)
Larger Bottle
![Page 44: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/44.jpg)
Larger Bottle
![Page 45: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/45.jpg)
Part 5: Conclusion
![Page 46: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/46.jpg)
![Page 47: Bottle Intro @ Tainan.py 2013.6.14](https://reader033.vdocuments.pub/reader033/viewer/2022052820/5484305eb47959f10c8b4b63/html5/thumbnails/47.jpg)
工商服務
• PyconTW 2013 (有教學課程)
敝公司徵才中...誰來教我寫前端啊 ... Orz