web 开发(3)- 视图函数VIEW

定义

view视图函数,为python函数,
视图函数有两个基本要求:

  1. 视图函数第一个参数就是接收来自客户端请求(request),为HttpRequest的类对象
    from django.http import HttpRequest

  2. 必须返回一个响应
    from django.http import HttpResponse

image

template

image

导入提示

alt + enter

posted @ 2024-09-08 08:54  温酒待君归  阅读(30)  评论(0)    收藏  举报
levels of contents