from fastapi import FastAPI from fastapi import Response import uvicorn #类似于while app=FastAPI() #路由装饰器 @app.get('/index.html') def index(): with open('python.html','r') as f: data=f.read() return Response(content=data,media_type='text/html') @app.get('/gdp.html') def gdp(): with open('python.html', 'r') as f: data = f.read() return Response(content=data, media_type='text/html') uvicorn.run(app,host='127.0.0.1',port=9991)
FastApi多个网页
最新推荐文章于 2024-06-18 09:30:42 发布