How to improve the reading time of files in an S3 bucket from Django?

I have a process in which I have to read several files from S3 to show them in a report.

list_images = Inspection_File.objects.filter(inspection_id=inspection.pk).order_by('category__name')
for image in list_images:
    image_data = image.file.read() #this process is very slow
    list_img.append({'file': img})

Analyzing the code I saw that the process of reading the file from the model is one that takes a long time, about 20 images take approximately 20 seconds, which is too long to wait, I understand that they are images, however, these images weigh less than 1MB, any ideas to improve the response time?

Back to Top