http 프로토콜: 통신 규약
--컴퓨터끼리 통신을 할 때의 약속
get방식 & post 방식-->서버에 요청
get 방식
서버로부터 정보를 조회하기 위해서 설계
쿼리 스트링을 통해 전송
(쿼리 스트링= http://hostname[:port]/folder/file?param1=value1¶m2=value2¶m3=value3 등의 형식을 가짐)
post 방식
서버내의 정보를 만들거나 수정할 때 사용
body을 이용해 전송-body안에 데이터를 넣어서 전송
<form action="/account/hello_world/" method="POST">
<!-- action에는 적용시킬 url을 작성 -->
{% csrf_token %}
<input type="submit" class="btn btn-primary " value="POST">
</form>
- action="/account/hello_world/"
action에 적힌 url대로 해당 내용이 작동됨
hello_world 함수를 작동시킴
def hello_world(request):
if request.method == "POST":
return render(request, 'accountapp/hello_world.html', context={'text': 'POST METHOD!'})
else:
return render(request, 'accountapp/hello_world.html', context={'text': 'GET METHOD!'})
request.method --> 프로토콜 방식
DB 정보 접근 및 장고 템플릿 내 for loop (0) | 2021.07.22 |
---|---|
텍스트 작성 내용 보이기 (17강) (0) | 2021.07.19 |
models.py class 작성 (14강) (0) | 2021.07.15 |
static 설정(11강) (0) | 2021.07.15 |
부트스트랩 적용 (10강) (0) | 2021.07.15 |
댓글 영역