解决办法:引入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)
原文地址:https://www.cnblogs.com/daicw/p/12053706.html
时间: 2024-09-27 21:08:59