美文网首页
diango 报错: didn't return an Http

diango 报错: didn't return an Http

作者: 远行_2a22 | 来源:发表于2019-03-25 15:20 被阅读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,报了上述错误
    解决办法:
    加上

    return HttpResponse(None)
    

    相关文章

      网友评论

          本文标题:diango 报错: didn't return an Http

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