DJANGO POST导致的403问题

由于Django有审核制度 所以不能直接post

需在models中添加解释器

from django.http import HttpResponse
from models import *
# 添加注释器来解决POST验证导致的403错误
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def hello(request):
    if request.method == 'POST':
        admin = request.POST.get("admin")
        password =  request.POST.get("password")
        m = Mysite(admin=admin,password=password)
        m.save()

        return HttpResponse("successful")
    return HttpResponse("fail")



你可能感兴趣的:(DJANGO POST导致的403问题)