Django crashes when upload a big file

No, you’re thinking that it’s in the upload handler, when I’m saying it’s happening before that. The http server has to receive the entire request before it hands it off to Django. Your code is never seeing the data because the server is exhausting memory before the request is completely received.

Do you have the nginx upload module installed and configured? If so, can you post your configuration for it? (Hmmm, I’ve never used Daphne behind it either, I don’t know if there are any configuration options for it.)

If by “framework problem”, you mean that it’s an artifact of the design of the HTTP protocol, you’d be correct. Web servers from the very beginning were designed to cache the entire request in memory before handing it along to the next stage of the process. There’s a reason why many tools for web-based file management set upload limits in the 10 - 250 MB range.

1 Like