Flask 开发 & Get/Post 请求

Flask环境搭建

pip install Flask # 大写的F

Flask 开发 & Get/Post 请求_第1张图片

from flask import Flask
import json
app=Flask(__name__)     #初始化app

@app.route('/')  #建立路由
def login():
    data = json.dumps({
        'name': 'moklv',
        'age': 13
    })
    return data

if __name__ == '__main__':
    app.run()     #运行app

Terminal console :

D:\pythom38\python.exe E:/Flask_study/study_0710.py
 * Serving Flask app 'study_0710' (lazy loading)
 * Environment: production
 * Running on http://127.0.0.1:5000 (Press CTRL+C to quit)
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
127.0.0.1 - - [10/Jul/2022 18:12:37] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [10/Jul/2022 18:12:37] "GET /favicon.ico HTTP/1.1" 404 -

 

你可能感兴趣的:(Python,软件测试)