做网站提成做网站国家大学科技园郑州
FastAPI默认使用Python的标准库来做json解析,如果换成rust编写的orjson,速度上会快一些
1. 安装依赖
pip install orjson 
2. 设置为默认响应类型
from fastapi.responses import ORJSONResponseapp = FastAPI(title='xxx', default_response_class=ORJSONResponse) 
FastAPI默认使用Python的标准库来做json解析,如果换成rust编写的orjson,速度上会快一些
1. 安装依赖
pip install orjson 
2. 设置为默认响应类型
from fastapi.responses import ORJSONResponseapp = FastAPI(title='xxx', default_response_class=ORJSONResponse)