程序執行后一直提示ValueError: HTTP status code must be an integer from 100 to 599.
遍歷代碼一切正常,然后開始調試代碼,找出獲取數據有問題,直接到except中,按理來講也只是報{code=10020, msg='param error'}
try: data = JSONParser().parse(request) except: return JsonResponse(code=10020, msg='param error')
將try...except注釋,再次運行提示{"detail":"JSON parse error - Expecting ',' delimiter: line 3 column 2 (char 14)"},json格式不對,修改格式
再次運行,發現還是提示ValueError: HTTP status code must be an integer from 100 to 599.
再次審查代碼,發現JsonResponse()參數傳入有誤
將status改為code
再次run,不會報奇怪的問題
總結:粗心大意浪費時間,細節很重要!!!!!!!