csrf_service.py 240 B

1234567
  1. from django.utils.deprecation import MiddlewareMixin
  2. class DisableCSRF(MiddlewareMixin):
  3. def process_request(self, request):
  4. if request.path.startswith('/api/'):
  5. setattr(request, '_dont_enforce_csrf_checks', True)