随便写写
程序员文章站
2022-05-24 17:33:03
向URL中添加变量部分 标记特殊字段为 , 这部分就可以作为参数传给函数rule可以制定一个可选的转换器 如:@app.route('/user/')def show_user_profile(u ......
向URL中添加变量部分 标记特殊字段为 <variable_name> , 这部分就可以作为参数传给函数
rule可以制定一个可选的转换器 如:<converter: variable_name>
@app.route('/user/<username>')
def show_user_profile(username):
# show the user profile for that user
pass
@app.route("/post/<int:post_id>")
def show_post(post_id):
#show the post with the given id, the id is an integer
pass
INT | 接受整型 |
FLOAT | 接受浮点型 |
PATH | 默认的行为,接受斜线 |
唯一的网址/重定向行为
@app.route('/projects')
def projects():
pass
@app.route('/about')
def about():
pass
上一篇: 一个微信群能卖100块?你卖的群都被用于微信红包扫雷了
下一篇: 野菜也有致癌功效,蕨菜致癌么