引言:
最近工作中有机会接触FastAPI这个框架,所以就把官方文档看了一遍,对框架的各个特性及使用方法做了总结,会逐步的发出来,希望对您有用。
如果您之前接触过python的其他框架,看起来会非常简单和顺畅,其实就是很简单。
【上一篇】:【FastAPI基础】17、文件操作
【下一篇】:【FastAPI基础】18、表单和文件操作
【FastAPI搭建好的产品框架源码,直接上手】:【FastAPI搭建好的产品架构】,直接上手
废话不多说,直接上源码,复制直接用呗,其他的就不粘贴了,没啥特别的。
如有需要help,下面私信我
# encoding: utf-8
"""
@author: 陈建华
@file: views.py
@time: 2021/2/17 11:10
@desc: 文件管理
"""
from typing import List
from fastapi import APIRouter, Depends, BackgroundTasks, HTTPException, Form, File, UploadFile
from server import config
from sqlalchemy.orm import Session
from starlette.responses import RedirectResponse
from starlette.requests import Request
from server.schemas.base import HttpResponseModel
from server.app_file.models.file import BaseFile
from server.utils.database import get_db
from server.utils import check_file
from server.utils.responses import response_code_set