视图函数响应处理:

from django.shortcuts import render,HttpResponse,redirect

 

1render 处理模板文件,可以渲染模板,第一个参数必须为封装好的元请求数据request

return  render(request,"index.html",{"name":"zhang"})

 

2HttpResponse  处理字符串数据,可以是带标签的字符串

return HttpRequest("<a href='http://www.baidu.com'>百度</a>")

 

3redirect  处理重定向文件

return redirect("index0.html")

 

相关文章:

  • 2022-02-02
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
  • 2021-11-04
  • 2022-12-23
猜你喜欢
  • 2021-08-25
  • 2021-08-31
  • 2021-07-24
  • 2021-04-09
相关资源
相似解决方案