当前位置:   article > 正文

Django响应(一)

Django响应(一)

一、HttpResponse与JsonResponse

image-20221016211540068

1.1、HttpResponse

官网:https://docs.djangoproject.com/zh-hans/4.1/ref/request-response/#django.http.HttpResponse

返回给浏览器端的响应对象

  1. from django.http import HttpResponse
  2. response = HttpResponse("Here's the text of the web page.")
  3. response = HttpResponse("Text only, please.", content_type="text/plain")
  4. response = HttpResponse(b'Bytestrings are also accepted.')

属性

    声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/56520
    推荐阅读
    相关标签
      

    闽ICP备14008679号