403 error with large media files on django server running nginx

限于喜欢 提交于 2019-12-05 10:25:52

I just came across the exact same problem. Thanks for your SO thread, otherwise I'd still be searching in the wrong place.

To fix this, you actually do not need to set DATA_UPLOAD_MAX_MEMORY_SIZE as long as you're only experiencing this error when uploading files. The Django documentation links to the other value, FILE_UPLOAD_MAX_MEMORY_SIZE, here.

Setting FILE_UPLOAD_MAX_MEMORY_SIZE to a higher limit in my settings.py resolves the problem, alongside with the aforementioned client_max_body_size in nginx.conf.

This sets the upload maximum to roughly 200 MB:

FILE_UPLOAD_MAX_MEMORY_SIZE = 200000000

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!