美文网首页
2019-11-08 csrf_exempt

2019-11-08 csrf_exempt

作者: 早起早起早起up | 来源:发表于2019-11-08 14:10 被阅读0次

csrf_exempt  

定义类  view

如果不是特定的get  post  delete 等  可以引入

from django.views.decorators.csrf import csrf_exempt

class MyView(View):

    def get(self, request):

        return HttpResponse("hi")

    def post(self, request):

        return HttpResponse("hi")

    @csrf_exempt

    def dispatch(self, *args, **kwargs):

        return super(MyView, self).dispatch(*args, **kwargs)

————————————————

版权声明:本文为CSDN博主「kongxx」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/kongxx/article/details/77322657

相关文章

网友评论

      本文标题:2019-11-08 csrf_exempt

      本文链接:https://www.haomeiwen.com/subject/qzgibctx.html