47
... 先不談 Django Joe @ Tainan.py 2013.6.14 你聽過 Bottle 嗎? 今天真的不會提到 Django!

Bottle Intro @ Tainan.py 2013.6.14

Embed Size (px)

DESCRIPTION

歡迎加入 Tainan.py: http://www.meetup.com/Tainan-py-Python-Tainan-User-Group/ -- 其實我的投影片都放在 speakerdeck: https://speakerdeck.com/excusemejoe

Citation preview

Page 1: Bottle Intro @ Tainan.py 2013.6.14

... 先不談 Django

Joe @ Tainan.py 2013.6.14

你聽過 Bottle 嗎?

今天真的不會提到 Django!

Page 2: Bottle Intro @ Tainan.py 2013.6.14

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

Part 1: About me

Page 4: Bottle Intro @ Tainan.py 2013.6.14

Joe應該算是文字工作者

平常用 Vim ...

Page 5: Bottle Intro @ Tainan.py 2013.6.14

PyConTw 2013 Volunteer

Python newer (1.5 year)

Work at startup:

My blog

Page 6: Bottle Intro @ Tainan.py 2013.6.14

Part 2: Bottle basic

Page 7: Bottle Intro @ Tainan.py 2013.6.14

Author

Page 8: Bottle Intro @ Tainan.py 2013.6.14

Author

Following RFC ... 德國人無誤 Good Job!!

Page 9: Bottle Intro @ Tainan.py 2013.6.14

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

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

Who use it ?

Page 12: Bottle Intro @ Tainan.py 2013.6.14

Rank

Page 13: Bottle Intro @ Tainan.py 2013.6.14

Documentations

Page 14: Bottle Intro @ Tainan.py 2013.6.14

Before Tutorial

Page 15: Bottle Intro @ Tainan.py 2013.6.14

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

Tutorial - hello world

Go to Official Website !

Page 17: Bottle Intro @ Tainan.py 2013.6.14

Tutorial - routing

Page 18: Bottle Intro @ Tainan.py 2013.6.14

Tutorial - static files

Page 19: Bottle Intro @ Tainan.py 2013.6.14

Tutorial - redirect

Page 20: Bottle Intro @ Tainan.py 2013.6.14

Tutorial - error pages

Page 21: Bottle Intro @ Tainan.py 2013.6.14

Tutorial - IO

Page 22: Bottle Intro @ Tainan.py 2013.6.14

Tutorial - cookies ...

Page 23: Bottle Intro @ Tainan.py 2013.6.14

Tutorial - file upload

Page 24: Bottle Intro @ Tainan.py 2013.6.14

Tutorial - WSGI

Page 25: Bottle Intro @ Tainan.py 2013.6.14

Tutorial - templates

Page 26: Bottle Intro @ Tainan.py 2013.6.14

Tutorial - plugins

Page 27: Bottle Intro @ Tainan.py 2013.6.14

Tutorial - others ...

Page 28: Bottle Intro @ Tainan.py 2013.6.14

Tutorial - more...

Go to Official Website or Blog !!

Page 29: Bottle Intro @ Tainan.py 2013.6.14

Part 3: Bottle + gevent

Page 30: Bottle Intro @ Tainan.py 2013.6.14

Gevent

Go to stieglitz.github.com/gevent-tutorial/

Page 31: Bottle Intro @ Tainan.py 2013.6.14

Run gevent server

Page 32: Bottle Intro @ Tainan.py 2013.6.14

Part 4: My sad story

Page 33: Bottle Intro @ Tainan.py 2013.6.14

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

Bottle and me

• Reasons:

思維不夠 Bottle ...創業問題 ... 之後再來聊聊 ...

Page 35: Bottle Intro @ Tainan.py 2013.6.14

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

Larger Bottle

Page 37: Bottle Intro @ Tainan.py 2013.6.14

Larger Bottle

Page 38: Bottle Intro @ Tainan.py 2013.6.14

Larger Bottle

Use python decorator, too ...

Page 39: Bottle Intro @ Tainan.py 2013.6.14

Larger Bottle

Page 40: Bottle Intro @ Tainan.py 2013.6.14

Larger Bottle

Page 41: Bottle Intro @ Tainan.py 2013.6.14

Larger Bottle

Page 42: Bottle Intro @ Tainan.py 2013.6.14

Larger Bottle

Page 43: Bottle Intro @ Tainan.py 2013.6.14

Larger Bottle

Page 44: Bottle Intro @ Tainan.py 2013.6.14

Larger Bottle

Page 45: Bottle Intro @ Tainan.py 2013.6.14

Part 5: Conclusion

Page 46: Bottle Intro @ Tainan.py 2013.6.14
Page 47: Bottle Intro @ Tainan.py 2013.6.14

工商服務

• PyconTW 2013 (有教學課程)

敝公司徵才中...誰來教我寫前端啊 ... Orz