首页 > 其他 > 详细

第十七节 模板渲染

时间:2020-03-08 18:54:11      阅读:57      评论:0      收藏:0      [点我收藏+]

技术分享图片

1 from django.shortcuts import render,HttpResponse,redirect,reverse
2 from django.template.loader import render_to_string
3 
4 def index(request):
5     html = render_to_string(index.html)
6     return HttpResponse(html)

第二种渲染方式

1 from django.shortcuts import render
2 
3 def index(request):
4     return render(request, index.html)

 

第十七节 模板渲染

原文:https://www.cnblogs.com/kogmaw/p/12443895.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!