FastAPI和MySql項目生成器,使用sqlalchemy ORM。
之前呢使用FastAPI是為了配合學習Vue,嘗試性寫的API服務接口,后面放到Github上面,感覺代碼寫的很爛,沒想到我關於FastAPI的項目有40多個老哥點
star
,還有幾位老哥issue
給出建議,或者咨詢我FastAPI的問題,都表示這方面的資料很少,所以我感覺自己有必要寫這么一個項目,幫助大家更好的學習FastAPI。
以下是我在GitHub托管的 fastapi-mysql-generator
FastAPI項目生成器代碼。
特性
- 可擴展的文件組織(仿照Flask項目組織)。
- JWT token 認證。
- 使用SQLAlchemy models(MySql) ORM或者原生SQL的CRUD操作。
- Alembic migrations 數據遷移。
- redis使用演示。
- 文件上傳演示。
- apscheduler 定時任務 (不保證穩定 noqa)
- aiocache 裝飾器緩存(未實現) https://github.com/tiangolo/fastapi/issues/651
GitHub地址
參考個人網站 https://www.charmcode.cn/article/2020-10-16_fastapi-mysql-generator