티스토리 뷰

장고 render 와 redirect 차이

- 단어 그대로 render 는 템플릿을 render 해주는 것이다. render 해줄때 context를 통해 데이터를 템플릿에 넘길 수 있다.

- 단어 그대로 redirect는 템플릿으로 redirect 해주는 것이다. url 로 이동한다고 볼 수 있다.

 

 

render()

render(request, template_name, context=None, content_type=None, status=None, using=None)

Combines a given template with a given context dictionary and returns an HttpResponse object with that rendered text.

Django does not provide a shortcut function which returns a TemplateResponse because the constructor of TemplateResponse offers the same level of convenience as render().

 
redirect()
redirect(to, *args, permanent=False, **kwargs)

Returns an HttpResponseRedirect to the appropriate URL for the arguments passed.

 

출처:

Django documentation - shortcut functions


오늘 한 일

- 딥러닝 강의 수강

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함