I have this one:from django.middleware.common import MiddlewareMixin from django.http import JsonResponse
class CorsMiddleware(MiddlewareMixin): def process_request(self, request): if request.method == "OPTIONS" and "HTTP_ACCESS_CONTROL_REQUEST_METHOD" in request.META: response = JsonResponse({"detail": "CORS policy allows this request"}) response["Access-Control-Allow-Origin"] = "*" response["Access-Control-Allow-Methods"] = "GET, POST, PUT, DELETE, OPTIONS" response["Access-Control-Allow-Headers"] = "Content-Type, Authorization" return response return None def process_response(self, request, response): response["Access-Control-Allow-Origin"] = "*" response["Access-Control-Allow-Methods"] = "GET, POST, PUT, DELETE, OPTIONS" response["Access-Control-Allow-Headers"] = "Content-Type, Authorization" return response AND: CORS_ALLOWED_ORIGINS = [ 'http://127.0.0.1:8000', ] BEFORE I DID PROXY,but my project stopped before starting. Please give me HElp -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8b81f71d-f925-437a-9e39-4c1566b05709n%40googlegroups.com.