随笔分类 -  FastAPI

摘要:from fastapi import FastAPI BOOKS = [ {"id": 1, "title": "book1"}, {"id": 2, "title": "book2"}, {"id": 3, "title": "book3"}, {"id": 4, "title": "book4 阅读全文
posted @ 2023-03-22 09:09 LeoShi2020 阅读(628) 评论(0) 推荐(0)
摘要:from fastapi import FastAPI app= FastAPI() # 静态路由优先级高于动态路由 # 必须写在动态路由的前面 @app.get("/books/most_populer") def books_most_populer(): return {"This Book 阅读全文
posted @ 2023-03-21 16:42 LeoShi2020 阅读(182) 评论(0) 推荐(0)
摘要:from fastapi import FastAPI app= FastAPI() # 静态路由模式 @app.get("/login") def login(): return {"msg":"Welcome CoCo Login"} @app.get("/books/{number}") # 阅读全文
posted @ 2023-03-21 16:29 LeoShi2020 阅读(46) 评论(0) 推荐(0)
摘要:1. 安装依赖 pip install -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com python-multipart 2. 表单程序 . ├── post_test_1.py └── templates ├── i 阅读全文
posted @ 2022-11-11 20:59 LeoShi2020 阅读(66) 评论(0) 推荐(0)
摘要:1. 插件库 pip install -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com jinja2 aiofiles 2. 模板渲染程序 2.1 Python程序 # _*_ coding: UTF-8 _*_ fro 阅读全文
posted @ 2022-11-11 20:23 LeoShi2020 阅读(149) 评论(0) 推荐(0)
摘要:1. 环境搭建 https://www.cnblogs.com/leoshi/p/15567193.html /root/.pyenv/versions/3.9.14/bin/python3.9 -m pip install -i http://pypi.douban.com/simple/ --t 阅读全文
posted @ 2022-11-11 19:16 LeoShi2020 阅读(56) 评论(0) 推荐(0)