from flask import Flask
app = Flask(__name__) # 定义一个应用
@app.route('/') # 装饰器 子定义一个路径的映射
def index():
return 'hello'
@app.route('/profile/<uid>/') # http://127.0.0.1:5000/profile/se/
def profile(uid):
return 'profile:' + uid #输出profile:se
@app.route('/profile/<int:uid>/') # http://127.0.0.1:5000/profile/12/
def profile(uid):
return 'profile:' + str(uid) #输出profile:12
if __name__ == '__main__':
app.run(debug=True)