flask 类视图(即插视图)
打开自动重启
app.run(debug=True)
1.装饰器方式
from flask import Flask app = Flask(__name__) @app.route("/hello") def hello(): return "hello world" app.run(debug=True)
2.路由配置方式
from flask import Flask app = Flask(__name__) def hello(): return "hello world" app.add_url_rule("/hello",view_func=hello) app.run(debug=True)