from flask import Flask
app = Flask(__name__)
app.route('/game', methods=['GET'])
def attendance():
return "hello"
if __name__ == '__main__':
app.run(debug=True)
答案 0 :(得分:0)
请参考此内容以最小化烧瓶的应用
https://flask.palletsprojects.com/en/1.1.x/quickstart/#a-minimal-application
您的示例如下所示:
app.py
from flask import Flask
app = Flask(__name__)
@app.route('/game')
def attendance():
return 'hello'
if __name__ == "__main__":
app.run(debug=True)
运行app.py(本地),然后在浏览器中以以下方式打开:
http://127.0.0.1:5000/game