设置为无可疑操作RequestDataTooBig

时间:2016-12-31 16:11:44

标签: django

我确实在django doc上找到了这篇文档:

引发SuspiciousOperation(RequestDataTooBig)之前请求正文的最大大小(以字节为单位)。在访问request.body或request.POST时完成检查,并根据不包括任何文件上载数据的总请求大小计算。 您可以将此项设置为“无”以禁用检查 。预计会收到异常大型表单帖子的应用程序应调整此设置。

但我不知道如何禁用该检查,我得到的错误是:

Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.

1 个答案:

答案 0 :(得分:2)

您可以在DATA_UPLOAD_MAX_MEMORY_SIZE = None内设置settings.py。但设置None可能会导致安全漏洞!