postman CSRF问题

app下创建 csrf_disable.py

在该文件中:

from rest_framework.authentication import SessionAuthentication
class CsrfExemptSessionAuthentication(SessionAuthentication):
def enforce_csrf(self, request):
return
视图中的SessionAuthentication用 CsrfExemptSessionAuthentication代替

猜你喜欢

转载自www.cnblogs.com/yushengzhou/p/9913944.html