The number of GET/POST parameters exceeded settings.DATA_UPLOAD_MAX_NUMBER_FIELDS

前端 未结 2 1341
灰色年华
灰色年华 2021-02-06 22:35

I got an error: \"The number of GET/POST parameters exceeded settings.DATA_UPLOAD_MAX_NUMBER_FIELDS\".

Error says that TooManyFieldsSent at /api/upload.

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-06 23:26

    This happened when I tried posting a huge list values to Backend. In my case I had the liberty of sending the list as a string, and it worked. Django by default has this check to prevent Suspicious activity(SuspiciousOperation).

    However below setting will also work.

    # to disable the check
    DATA_UPLOAD_MAX_NUMBER_FIELDS = None
    

    You can set this to None to disable the check. Applications that are expected to receive an unusually large number of form fields should tune this setting. From Django official documentation. https://docs.djangoproject.com/en/3.1/ref/settings/#data-upload-max-number-fields

提交回复
热议问题