To fix Python Django CSRF Cookie Not Set, we can add the csrf_exempt
decorator to our view.
For instance, we write
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def your_view(request):
if request.method == "POST":
# do something
return HttpResponse("Your response")
to apply the @csrf_exempt
to the your_view
view to make Django ignore the CSRF token check on the view.