Files
cattleTransportation/.cursor/rules/frameworks/flask.mdc
2025-11-04 09:38:19 +08:00

16 lines
573 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
description: Flask 轻量级 Python Web 应用程序的约定和最佳实践。
globs: **/*.py
alwaysApply: false
---
# Flask 规则
- 使用 Blueprints 按功能或资源组织路由
- 使用 Flask-SQLAlchemy 处理数据库模型和 ORM
- 使用应用工厂application factories实现灵活的应用初始化
- 使用 Flask 扩展实现常见功能Flask-Login、Flask-WTF 等)
- 在环境变量中存储配置
- 使用 Flask-Migrate 进行数据库迁移
- 使用错误处理器实现适当的错误处理
- 使用 Flask-RESTful 或类似工具构建 API