from django.views.decorators.csrf import csrf_exempt
@csrf_exempt # 前端ajax请求时需要验证,否则403
def fun(request):
if request.method == 'POST': # 请求方式时Post则响应
HttpResponse('ok')
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt # 前端ajax请求时需要验证,否则403
def fun(request):
if request.method == 'POST': # 请求方式时Post则响应
HttpResponse('ok')