# -*- coding: utf-8 -*-
from flask import Flask, request
app = Flask(__name__)
# http://192.168.10.15:8000
@app.route("/")
def hello():
print("hello")
return "Hello World!"
# URLパス変数
# http://localhost:8000/test1/hoge
@app.route("/test1/<path>")
def test1(path):
print("path={}".format(path))
return "test1 path={}".format(path)
# URLパラメータ
# http://localhost:8000/test2?path=hoge
@app.route("/test2")
def test2():
path = request.args.get('path',
default=None, type=str)
print("path={}".format(path))
return "test2 path={}".format(path)
if __name__ == "__main__":
#app.run()
print("app.url_map={}".format(app.url_map))
app.run(host='0.0.0.0', port=8000,
debug=True) |