# Django配置错误：你正在使用staticfiles应用而没有设置STATIC_ROOT为文件系统路径。

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

## 根因

在使用collectstatic或生产环境中提供静态文件时，STATIC_ROOT未配置。

## 版本兼容性

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

## 解决方案

1. **Set STATIC_ROOT in settings.py** (95% 成功率)
   ```
   STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
   ```
2. **Run collectstatic after setting** (90% 成功率)
   ```
   python manage.py collectstatic
   ```

## 无效尝试

- **Setting STATIC_ROOT to a non-existent path** — Directory must exist or be created. (80% 失败率)
- **Ignoring the setting and using STATICFILES_DIRS only** — collectstatic requires STATIC_ROOT. (90% 失败率)
