Bootstrap

彻底关闭django的csrf认证

middleware.py

from django.utils.deprecation import MiddlewareMixin


class CloseCsrfMiddleware(MiddlewareMixin):

    def process_request(self, request):
        print('csrf')
        request.csrf_processing_done = True  # csrf处理完毕

将该文件插入settings.py

在这里插入图片描述

;