转载:https://www.cnblogs.com/lsdb/p/10488448.html

已经安装了Python3,本机环境是anaconda Python3.6

二:安装flask

conda install Flask

三:第一个应用程序

# 导入Flask类
from flask import Flask
# 实例化,可视为固定格式
app = Flask(__name__)

# route()方法用于设定路由;类似spring路由配置
@app.route('/')
def hello_world():
    return 'Hello, World!'

if __name__ == '__main__':
    # app.run(host, port, debug, options)
    # 默认值:host=127.0.0.1, port=5000, debug=false
    app.run()

四:访问刚刚执行的代码:

访问:http://127.0.0.1:5000/helloworld。结果如下图:

flask安装

 

相关文章:

  • 2022-02-12
  • 2022-12-23
  • 2021-10-11
  • 2021-09-29
  • 2021-07-11
  • 2021-11-07
  • 2021-07-21
  • 2021-10-01
猜你喜欢
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2021-04-16
  • 2021-11-23
相关资源
相似解决方案