Hi
I'm having trouble using this library to actually stream the response. When exporting, only a small chunk of data will be sent at first and then the rest of data is sent at the same time that all serialization is done.
here is the code I'm using (inside a View) which is the same as the example in the docs:
def serializer(x):
time.sleep(1)
return [d.values() for d in ReportSerializer(x, many=True).data]
stream = xlsx_streaming.stream_queryset_as_xlsx(qs, template, serializer=serializer, batch_size=10)
response = StreamingHttpResponse(stream, content_type='application/vnd.xlsxformats-officedocument.spreadsheetml.sheet')
response["Content-Disposition"] = 'attachment; filename="report.xlsx"'
return response
When I use a cURL request to the view, I get a chunk of data very fast, but the rest of data arrives at the same time when the queryset is exhausted.
Hi
I'm having trouble using this library to actually stream the response. When exporting, only a small chunk of data will be sent at first and then the rest of data is sent at the same time that all serialization is done.
here is the code I'm using (inside a View) which is the same as the example in the docs:
When I use a cURL request to the view, I get a chunk of data very fast, but the rest of data arrives at the same time when the queryset is exhausted.