2024-02-26 20:23:04 +08:00

10 lines
517 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from flask import Flask
app = Flask(__name__) # 创建Flask应用程序实例。将__name__作为参数传递给 Flask 类的构造函数可以告诉Flask应用程序在哪里寻找静态文件夹、模板文件夹等相关资源。
@app.route('/') # 定义一个路由将根URL'/'与hello()函数关联起来
def hello():
return 'Hello World!'
if __name__ == '__main__': # 运行应用程序
app.run(debug=True) # 增加debug=True可以实现自动重载Flask会监视代码是否更改