Files
blogweb/backend/app/initial_data/README.md
T
2025-12-26 13:42:22 +08:00

22 lines
442 B
Markdown

# 初始数据模块
此目录用于存放数据库初始化时的示例数据脚本。
## 使用说明
在数据库初始化后,可以运行此模块中的脚本来插入示例数据,方便开发和测试。
## 示例
```python
from app.db.session import SessionLocal
from app.models.user import User
from app.core.security import get_password_hash
def init_data():
db = SessionLocal()
# 创建示例用户等
...
```