Django响应(一)

一、HttpResponse与JsonResponse

image-20221016211540068

1.1、HttpResponse

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

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

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

属性

    相关推荐

    1. Django请求与响应

      2024-02-03 07:00:07       42 阅读
    2. django框架、断言、请求与响应

      2024-02-03 07:00:07       60 阅读

    最近更新

    1. docker php8.1+nginx base 镜像 dockerfile 配置

      2024-02-03 07:00:07       94 阅读
    2. Could not load dynamic library ‘cudart64_100.dll‘

      2024-02-03 07:00:07       100 阅读
    3. 在Django里面运行非项目文件

      2024-02-03 07:00:07       82 阅读
    4. Python语言-面向对象

      2024-02-03 07:00:07       91 阅读

    热门阅读

    1. 架构篇31:如何应对接口级的故障?

      2024-02-03 07:00:07       49 阅读
    2. Kong 速率限制

      2024-02-03 07:00:07       53 阅读
    3. SpringBoot使用Kafka详解含完整代码

      2024-02-03 07:00:07       53 阅读
    4. Kotlin 的 Flow 简单使用

      2024-02-03 07:00:07       41 阅读
    5. python使用fabric库

      2024-02-03 07:00:07       48 阅读
    6. 区块链赋能编程:开启数字世界的新篇章

      2024-02-03 07:00:07       56 阅读