# 请求数据过大错误：请求体超过 settings.FILE_UPLOAD_MAX_MEMORY_SIZE。

- **ID:** `python/django-request-body-too-large`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

上传文件超过内存中的上传限制。

## 版本兼容性

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

## 解决方案

1. **** (90% 成功率)
   ```
   Set FILE_UPLOAD_MAX_MEMORY_SIZE = 10485760 (10MB) in settings.py.
   ```
2. **** (85% 成功率)
   ```
   Use FILE_UPLOAD_HANDLERS to stream large files to disk: ['django.core.files.uploadhandler.TemporaryFileUploadHandler']
   ```

## 无效尝试

- **** — Increasing only DATA_UPLOAD_MAX_MEMORY_SIZE doesn't affect file upload limit. (60% 失败率)
- **** — Setting FILE_UPLOAD_MAX_MEMORY_SIZE=0 disables limit but can cause memory issues. (40% 失败率)
