视图响应了方法写错了,不支h持Response,
请使用HttpResponse
JsonResponse
HttpResponse的子类
HttpResponseRedirect 301
HttpResponsePermanentRedirect 302
HttpResponseNotModified 304
HttpResponseBadRequest 400
HttpResponseNotFound 404
HttpResponseForbidden 403
HttpResponseNotAllowed 405
HttpResponseGone 410
HttpResponseServerError 500
redirect
redirect重定向
建议redirect(重定向)和我们前面学习的reverse搭配使用.
from django.http import HttpResponse
def demo_view(request):
return HttpResponse('python', status=400)
或者
response = HttpResponse('python')
response.status_code = 400
response['python'] = '111'
return response