Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fastapi-practices/fastapi_sqlmodel_mysql
fastapi 基础脚手架, fastapi + pydantic-v2 + sqlmodel + alembic + mysql + redis
https://github.com/fastapi-practices/fastapi_sqlmodel_mysql
fastapi fastapi-sqlmodel fastapi-template pydantic-v2
Last synced: about 2 months ago
JSON representation
fastapi 基础脚手架, fastapi + pydantic-v2 + sqlmodel + alembic + mysql + redis
- Host: GitHub
- URL: https://github.com/fastapi-practices/fastapi_sqlmodel_mysql
- Owner: fastapi-practices
- License: mit
- Created: 2023-10-17T08:17:53.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-02-01T03:55:52.000Z (11 months ago)
- Last Synced: 2024-02-01T04:47:25.333Z (11 months ago)
- Topics: fastapi, fastapi-sqlmodel, fastapi-template, pydantic-v2
- Language: Python
- Size: 36.1 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# FastAPI SQLModel Architecture
作为 FastAPI 框架的一个基础项目,基于 python3.10 开发
## 特征
- [x] FastAPI > 0.100.0
- [x] Async design
- [x] Restful API
- [x] SQLAlchemy 2.0
- [x] Pydantic 2.0
- [ ] ......## TODO
- [ ] Docker
## 使用
> [!WARNING]
> 此过程请格外注意端口占用情况, 特别是 8000, 3306, 6379...### 1: 传统
1. 安装依赖项
```shell
pip install -r requirements.txt
```2. 创建一个数据库 `fsm`, 选择 utf8mb4 编码
3. 安装启动 redis
4. 在 `backend/app/` 目录下创建一个 `.env` 文件```shell
cd backend/app/
touch .env
```5. 复制 `.env.example` 到 `.env`
```shell
cp .env.example .env
```6. 数据库迁移 [alembic](https://alembic.sqlalchemy.org/en/latest/tutorial.html)
```shell
cd backend/app/
# 生成迁移文件
alembic revision --autogenerate
# 执行迁移
alembic upgrade head
```7. 执行 backend/app/main.py 文件启动服务
8. 浏览器访问: http://127.0.0.1:8000/api/v1/docs---
### 2: docker
[TODO](#TODO)
## 互动
[WeChat / QQ](https://github.com/wu-clan)
## 赞助
如果此项目能够帮助到你,你可以赞助作者一些咖啡豆表示鼓励:[:coffee: Sponsor :coffee:](https://wu-clan.github.io/sponsor/)
## 许可证
本项目根据 MIT 许可证的条款进行许可