django-csrf_exempt

from django.views.decorators.csrf import csrf_exempt

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

猜你喜欢

转载自www.cnblogs.com/tangpg/p/9116869.html
今日推荐