HttpResponse vs. Render

后端 未结 3 1048
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-05 15:22

I was looking over some code and came to this question -- Django: What is the difference b/w HttpResponse vs HttpResponseRedirect vs render_to_response -- which discusses the di

3条回答
  •  深忆病人
    2021-02-05 15:23

    render is used to for what the name already indicate: to render a template file (mostly html, but could be any format). render is basically a simple wrapper around a HttpResponse which renders a template, though as said in the previous answer you can use HttpResponse to return others things as well in the response, not just rendering templates.

提交回复
热议问题