flask 获取URL(flask 4)

2019-08-13 14:34:41 浏览数 (1)

@app.route('/') def index(): return "aa"

url_for('index') 返回/

@app.route (’ / hello /<ame > ’ ) def greet (name) : return ’ Hello 毛s ' ’ 宅name

url_for('greet',name='jack') 返回/hello/jack

url_for('greet',name='jack',_external=True) 返回 http://xxxx:3333/hello/jack

0 人点赞