赞
踩
引用FastAPI官网:“FastAPI 是一个用于构建 API 的现代、快速(高性能)的 web 框架,使用 Python 3.6+ 并基于标准的 Python 类型提示。”
官网地址:https://fastapi.tiangolo.com/zh/
Python 3.6 及更高版本
- pip install fastapi
- pip install uvicorn
示例可查看官网示例,这里不多赘述。以下示例主要展示FastAPI结合sqlite完成增删改查。废话不多说,直接上代码:
数据库表结构:
首先创建models.py
- from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
-
- from database import Base
-
-
- class Student(Base):
- __tablename__ =
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。