當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python Django csrf_exempt用法及代碼示例

本文介紹 django.views.decorators.csrf.csrf_exempt 的用法。

聲明

csrf_exempt(view)

此裝飾器將視圖標記為不受中間件確保的保護。例子:

from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt

@csrf_exempt
def my_view(request):
    return HttpResponse('Hello world')

相關用法


注:本文由純淨天空篩選整理自djangoproject.com大神的英文原創作品 django.views.decorators.csrf.csrf_exempt。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。