Sorry, your browser cannot access this site
This page requires browser support (enable) JavaScript
Learn more >
1
2
3
4
5
6
7
from flask import Flask  

app = Flask(__name__) #创建实例

@app.route("/") #定义url路径,route()定义触发函数的url
def hello_world():
return "<p>Hello, World!</p>"
1
<converter:variable_name>     通过设置converter来实现变量类型控制

url_for() #通过函数返回url

redirect() #重定向

errorhandler() #捕捉错误信息

escape() #手动转义 (可忽略)

get_flashed_messages() #显示闪现内容

make_response() #创建响应对象

abort() #退出请求

test_request_context() #创建一个模拟的请求上下文

评论