백엔드 Back-end/장고 Django 21

Q. 장고django에서 post, put, delete 방식 사용 위해서 csrf 끄는 방법은?

A. @csrf_exempt 를 사용하면 된다. 참고: csrf란? 사이트 간 요청 위조 API를 만들 경우 CSRF 보안이 필요하지 않다. API 서버는 API Key 등 다른 인증 방식을 사용한다. 그래서 csrf를 끌 필요가 있다. 출처: Cross Site Request Forgery protection from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt @csrf_exempt def my_view(request): return HttpResponse('Hello world') 코드 예는 다음과 같다. from django.http import JsonResponse from django...

파이썬 장고Django request에서 파라미터parameter 값 갖고 오기

GET 방식으로 key란 파라미터의 값을 가져온다면? ?key=1234 key = request.GET.get('key', None) 로 가져오고 만약에 key란 파라미터가 없다면 None이 된다. 참고: django.http.request Documentation self.GET = QueryDict(mutable=True) self.POST = QueryDict(mutable=True) QueryDict에 대한 설명을 찾아보면 다음과 같다. (출처: django.http.QueryDict) QueryDict implements all the standard dictionary methods because it’s a subclass of dictionary. Exceptions are outlined..

Q. Python파이썬 웹프레임워크 Django장고 이름의 유래는?

A. Django는 재즈 집시 기타리스트 이름에서 따왔다. 공식 문서를 보면 아래와 같이 설명이 나온다. (출처: Django documentation FAQ: General) What does “Django” mean, and how do you pronounce it? Django is named after Django Reinhardt, a jazz manouche guitarist from the 1930s to early 1950s. To this day, he’s considered one of the best guitarists of all time. Listen to his music. You’ll like it. Django is pronounced JANG-oh. Rhymes with ..