I got an error: "The number of GET/POST parameters exceeded settings.DATA_UPLOAD_MAX_NUMBER_FIELDS".
Error says that TooManyFieldsSent at /api/upload.
I wrote in my views.py.
def upload(request):
id, array = common(request)
if request.FILES:
file = request.FILES['req'].temporary_file_path()
else:
return HttpResponse('<h1>NG</h1>')
return HttpResponse('<h1>OK</h1>')
def common(request):
id = json_body.get("access", "0")
if id == "":
id = "0"
s = []
with open(ID_TXT, 'r') as f:
for line in f:
s += list(map(int, line.rstrip().split(',')[:-1]))
array = [s[i:i + 2] for i in range(0, len(s), 2)]
return id, array
I post access & req data by using POSTMAN like: 
I think this error is limitation of being able to send file size, so I added the code to settings.py
DATA_UPLOAD_MAX_MEMORY_SIZE = 100000000
But the error didn't solved. I read this page: How to avoid "The number of GET/POST parameters exceeded" error? as a reference. How should I fix this?

所有评论(0)