Compressing the response payload in Django REST?

前端 未结 3 694
悲&欢浪女
悲&欢浪女 2020-12-11 04:25

I was wondering: would it be possible to compress the response payload in Django REST?

At the moment, the response payloads are plain JSON data. However, there\'s qu

3条回答
  •  情歌与酒
    2020-12-11 05:08

    HTTP response compression will most likely not be handled by Django but by your HTTP server using the gzip or deflate algorithms.

    You just need to make sure your HTTP server is configured to compress HTTP Responses with Content-Type header set to application/json.

    How to enable gzip compression for nginx: https://rtcamp.com/tutorials/nginx/enable-gzip/

提交回复
热议问题