Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
118 views
in Technique[技术] by (71.8m points)

python - Django crash when upload a big file

I'm trying to send a big file (more than 2.7 GB) with axios to Django:

const formData = new FormData()
formData.append('myFile', myFile)
const config = {...}
axios.post(url, formData, config)...

Now, it sends all the data, but the memory usage starts growing even before the view starts!

def my_view(request: HttpRequest) -> HttpResponse:
    print('Starts the view')
    ...

If the file is small the message prints correctly, now with the huge file the server crashes due to memory usage before the print is reached. I've tried to change the upload handler to only use disk in settings.py:

FILE_UPLOAD_HANDLERS = ['django.core.files.uploadhandler.TemporaryFileUploadHandler']

But had the same result. I don't know whats happening, I can't even try this solution as nothing of the view's code is executed. What I'm missing? Any kind of help would be really appreciated

Update:

I've made a question in Django official forum where more information is available about solution and problems about this

question from:https://stackoverflow.com/questions/65907005/django-crash-when-upload-a-big-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...