參考:http://bottlepy.org/docs/dev/bottle-docs.pdf python
解壓安裝:python setup.py installspa
小試:命令行
# -*- coding: utf-8 -*- #file : basic.py from bottle import route, run, template @route('/hello/<name>') def index(name): return template('<b>Hello {{name}}</b>!', name=name) run(host='localhost', port=8081)
# -*- coding: utf-8 -*- #file : basic2.py from bottle import Bottle, run app = Bottle() @app.route("/hello") def hello(): return "Hello World!" run(app, host="localhost", port=8081)
dos命令行運行:code
python basic1.py md5
http://localhost:8081/hello/world utf-8
python basic2.py
get
http://localhost:8081/hello class
效果分別爲:pdf