Hi,
I am using the django to handle the file upload.
In the view implementation, I am trying to write the uploaded file to disk, but it causes bad performance because writing the uploaded file to disk spend lots of time.
Is any better solution to handle the file upload? Maybe create a detach thread to handle the file writing
The below is the simplified view implementation:
```
def upload_file(request):
if request.method == 'POST':
form = UploadFileForm(request.POST, request.FILES)
if form.is_valid():
with open('some/file/name.txt', 'wb+') as destination:
for chunk in f.chunks():
destination.write(chunk)
return HttpResponseRedirect('/success/url/')
else:
form = UploadFileForm()
return render(request, 'upload.html', {'form': form})
```
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[hidden email].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/e527a0a7-2e8e-4225-b212-fd6767ece12cn%40googlegroups.com.