首页 > 代码库 > HTTP

HTTP

技术分享

 

from flask import Flask

app = Flask(__name__) # 定义一个应用

@app.route(‘/‘) # 装饰器 子定义一个路径的映射
def index():
return ‘hello‘

@app.route(‘/profile/<uid>‘)
def profile(uid):
return ‘profile:‘ + uid

if __name__ == ‘__main__‘:
app.run(debug=True)

HTTP