413 Payload Too Large on Django server

If your team was/is using Django Channels, there was a piece of code introduced in 2.1.7 causing an unintended 413 error (discussed here). This was fixed in 2.3.0, however.


Django has a build in mechanism to prevent any suspicious activity.

In your settings.py file set the variable

DATA_UPLOAD_MAX_MEMORY_SIZE = 10*1024*1024  # your size limit in bytes

See documentation: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-DATA_UPLOAD_MAX_MEMORY_SIZE