美文网首页
django报错:multivaluedictkeyerror

django报错:multivaluedictkeyerror

作者: 远行_2a22 | 来源:发表于2019-03-25 15:24 被阅读0次

    代码

    def save_player_data(request):
        if request.method == 'POST':
            requestBody = request.body
            print(requestBody)
            player_username = request.POST['player_username']
            player_health = request.POST['player_health']
            player_score = request.POST['player_score']
            print(player_username, player_health, player_score)
        return HttpResponse(None)
    

    找了好久,最后居然是前端发送过来的数据名写错了。
    player_username 写成了palyer_username。所以
    一定要仔细检查这里的前后端的键值是否一致。

    相关文章

      网友评论

          本文标题:django报错:multivaluedictkeyerror

          本文链接:https://www.haomeiwen.com/subject/cdxbvqtx.html