Python的Web框架 Bottle.py
Bottle 是一個快速、簡單而且輕量級的 WSGI 微型 web 框架,可使用一個簡單的單文件模塊分發,無需依賴其他 Python 標準庫。
Bottle 包含模塊有:
- 路由: Requests to function-call mapping with support for clean and dynamic URLs.
- 模板: Fast and pythonic built-in template engine and support for mako, jinja2 and cheetah templates.
- 工具: Convenient access to form data, file uploads, cookies, headers and other HTTP-related metadata.
- 服務器: 內建 HTTP 開發服務器,支持 paste, fapws3, bjoern, Google App Engine, cherrypy or any other WSGI capable HTTP server.
示例代碼:
from bottle import route, run @route('/hello/:name') def index(name='World'): return '<b>Hello %s!</b>' % name run(host='localhost', port=8080)
本文由用戶 openkk 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!