3
をダウンロード:Djangoは、私はこのコードを持っているビュー上のCSVファイルを生成し、
with open('stockitems_misuper.csv', 'wb') as myfile:
wr = csv.writer(myfile, quoting=csv.QUOTE_ALL)
wr.writerows(file_rows)
response = HttpResponse(myfile, content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename=stockitems_misuper.csv'
return response
を私はエラーを取得:
I/O operation on closed file
は、どのように私は、フロントエンドに作成したCSVファイルを送信することができますか?あなたが書き込まれているファイルのハンドルを渡して(とあなたのインデントのわからない、あなただけのwith
ブロックの外に可能性があり