Ответ файла xlxs не является корректным. Он возвращает в ответ мусорные символы

def daily_report_summery(request):
    body = request.body
    data = json.loads(body)
    date = data['date']
    generate_summary_report_xl(date)
    with open('./Daily_Report.xlsx', "rb") as file:
      response = HttpResponse(file.read(),content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
      response['Content-Disposition'] = 'attachment; filename=Daily_Report.xlsx'
    return response

Я получаю такой ответ: ответ

Я хочу отправить файл Daily_Report.xlsx из бэкенда.

Вернуться на верх