@csrf_exempt(免除csrf验证)
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def index(request):
if request.method == 'GET':
return HttpResponse('GET请求')
elif request.method == 'POST':
return HttpResponse('POST请求')
@csrf_exempt(免除csrf验证)
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def index(request):
if request.method == 'GET':
return HttpResponse('GET请求')
elif request.method == 'POST':
return HttpResponse('POST请求')