Upload large files Flask Nginx Uwsgi Upload large files Flask Nginx Uwsgi flask flask

Upload large files Flask Nginx Uwsgi


Thank you Frank for your answer, has been some time since I opened this post. If I recall correctly the error was a bit more subtle: Flask doesn't have by default a "retry" logic builtin. This in combination with the cheapest server I could find for testing contribuite to the failure of some of the most expensive requests. Implementing a "retry" logic with the retry decorator solved my issue.


It looks like you have set the variables correctly. Perhaps you have the config setting MAX_CONTENT_LENGTH set in your Flask app? It would look something like this:

app.config['MAX_CONTENT_LENGTH'] = 50 * 1024 * 1024 # 50 MB

By default, Flask shouldn't complain with large requests, but if this variable is set then it will throw 413 errors when the request exceeds the specified value. Check here for more info.

Lastly, make sure you're reloading Nginx and your uWSGI service with these commands:

> sudo systemctl restart nginx.service> sudo systemctl restart <yourservice>.service

The .service suffixes are optional.