This commit is contained in:
2024-02-26 20:23:04 +08:00
parent 342efb8562
commit 5367038e59
4 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
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会监视代码是否更改