更新 Python/Web/.cursorrules
This commit is contained in:
@@ -35,11 +35,9 @@ description: Python Web开发最佳实践与规范
|
|||||||
│ ├── __init__.py
|
│ ├── __init__.py
|
||||||
│ ├── routes.py # 路由
|
│ ├── routes.py # 路由
|
||||||
│ ├── schemas.py # Pydantic模型
|
│ ├── schemas.py # Pydantic模型
|
||||||
│ └── crud.py # 数据库操作
|
|
||||||
│ └── utils.py # 工具函数
|
│ └── utils.py # 工具函数
|
||||||
├── api # 接口
|
├── api # 接口
|
||||||
│ ├── __init__.py
|
│ ├── __init__.py
|
||||||
│ ├── crud.py # 数据库操作
|
|
||||||
│ ├── routes.py # 路由
|
│ ├── routes.py # 路由
|
||||||
│ ├── schemas.py # Pydantic模型
|
│ ├── schemas.py # Pydantic模型
|
||||||
│ └── utils.py # 工具函数
|
│ └── utils.py # 工具函数
|
||||||
@@ -90,6 +88,7 @@ description: Python Web开发最佳实践与规范
|
|||||||
- 使用[wrapt](https://wrapt.readthedocs.io/en/latest/)库创建装饰器
|
- 使用[wrapt](https://wrapt.readthedocs.io/en/latest/)库创建装饰器
|
||||||
- 装饰器应位于`$PROJECT_ROOT/app/$MODULE_NAME/utils.py`文件中
|
- 装饰器应位于`$PROJECT_ROOT/app/$MODULE_NAME/utils.py`文件中
|
||||||
|
|
||||||
## 函数返回值
|
## 异常处理
|
||||||
|
|
||||||
- 函数返回值应使用`returns`库
|
- 除非特别说明,否则不要捕获任何异常
|
||||||
|
- 在`$PROJECT_ROOT/app/core/exceptions.py`文件中创建自定义异常类
|
||||||
|
|||||||
Reference in New Issue
Block a user