>bottleというフレームワークが素晴らしくシンプルだったので、書いてみる。
まずはインストール。
pip install bottle
適当なフォルダに以下のファイル作成。
test.py
from bottle import route, run
@route('/hello/:name')
def index(name='World'):
return '<b>Hello %s!</b>' % name
run(host='localhost', port=8100)
あとは実行するだけ。
python test.py
http://localhost:8100/hello/matsu で以下の画面が出る。
超簡単!
