djangopost请求报错:Forbidden (CSRF token missing or incorrect.)

解决办法:引入csrf_exempt包:

from django.views.decorators.csrf import csrf_exempt

然后增加装饰器:

@csrf_exempt
def register(request):  
    request.encoding='utf-8'
    if request.GET:
        return render(request,'register.html')
    elif request.POST:
        dictData = request.POST
        context = {}
        print(dictData)
上一篇:Spring MVC基本配置和实现(三)


下一篇:texi2html 源码编译