# 文件未找到错误：没有这样的文件或目录：'static/css/style.css'

- **ID:** `python/starlette-static-files-not-found`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

静态文件目录配置错误或文件路径不存在。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   from starlette.staticfiles import StaticFiles
app.mount('/static', StaticFiles(directory='static'), name='static')
   ```

## 无效尝试

- **** — 在部署时路径会变化，导致失败 (85% 失败率)
- **** — 会导致前端资源加载失败，用户体验差 (70% 失败率)
