[Fixed]-Django – post data query dict is empty

27👍

request.POST is only for application/x-www-form-urlencoded data. Since you are using json, you should use request.body with json.loads.

import json

def my_view(request):
    data = json.loads(request.body.decode('utf-8'))
    ...

Leave a comment