A
A
Alexander2017-07-17 07:43:49
Django
Alexander, 2017-07-17 07:43:49

Why do I get a Failed - Network error when downloading a file?

simple code for uploading a file from the server:

from django.http import HttpResponse, FileResponse
...
def get_file(request, type):
    item = Download.objects.get(name=type)
    filename = item.file.name.split('/')[-1]
    response = FileResponse(item.file)
    response['Content-Disposition'] = 'attachment; filename=%s' % filename
    return response

File weighing 17mb. After the download starts, it takes about 7-10 seconds and then the error Failed - Network error
The problem is in production . Also, for the sake of testing, I launched the runserver command through manage.py
python3 manage.py runserver 0.0.0.0:8000 , I go through ip : my_ip_on_production_server:8000 the file is downloaded completely normally. The problem is not in the code 100%.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Chudnovsky, 2017-07-17
@kentuck1213

I think it's because of nginx.org/ru/docs/http/ngx_http_core_module.html#c...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question