# my_fastapi **Repository Path**: xuedejin/my_fastapi ## Basic Information - **Project Name**: my_fastapi - **Description**: FastAPI后端练习项目 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2025-08-06 - **Last Updated**: 2025-08-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: FastAPI, 依赖注入, session链式调用封装, sqlmodel, WebSocket ## README ### 启动 uvicorn main:app --reload uvicorn app.main:app --reload ### 检查端口占用 netstat -ano | findstr :8000 ### 结束Python相关进程 taskkill /f /im python.exe ### 安装依赖 pip install -r requirements.txt ### isort your_file.py # 先整理import black your_file.py # 然后格式化代码 flake8 your_file.py # 最后检查 ## black的使用 ### 安装 black ```sh pip install black ``` ### 基本使用 对单个文件格式化 ```sh black your_fastapi_file.py ``` 格式化整个目录 ```sh black app/ ``` ### 常用配置选项 检查而不修改 ```sh black --check app/ ``` 指定行长度 ```sh black --line-length 120 app/ ``` 排除目录/文件 ```sh black --exclude '/migrations|tests' app/ ```