python web框架之 bottle

参考:http://bottlepy.org/docs/dev/bottle-docs.pdf python

下载:https://pypi.python.org/packages/source/b/bottle/bottle-0.11.6.tar.gz#md5=0bafdc4e13ea2b1a3bddf36b5af108c4 app

解压安装: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

相关文章
相关标签/搜索