I have a django application on which I upload several files of huge size. Once in my view, I want to do an asynchronous task on those files:
def my_view(request):
Thread(target=_my_task, args=[request.FILES]).start())
return redirect(my_url)
The problem is, by the time I uses the files in my thread, the main request has finished and the request object is deleted, alongside the InMemoryUploadedFile objects contained in it, and I get an IO exception:
ValueError: I/O operation on closed file.
How can I force the persistence of those files without writing them in my filesystem ?