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

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

## 根因

Starlette 静态文件挂载要求目录存在；如果文件丢失或路径错误，则会发生此错误。

## 版本兼容性

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

## 解决方案

1. **Create the static directory and place files** (100% 成功率)
   ```
   mkdir -p static
# place style.css in static/
   ```
2. **Mount static files with correct path** (95% 成功率)
   ```
   from starlette.staticfiles import StaticFiles
app.mount('/static', StaticFiles(directory='static'), name='static')
   ```

## 无效尝试

- **Using a relative path that doesn't exist** — The path must be absolute or relative to the current working directory. (90% 失败率)
- **Not mounting the static files at all** — Static files won't be served. (100% 失败率)
