2
It might be giving this error because you might be having the CSRF protection turned on in middelware settings.
If you donβt need that protection, you can set the view as CSRF exempt.
You can simply use a decorator on the view or you can turn it disable it from middleware settings.
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
@csrf_exempt
def my_view(request):
return HttpResponse('Hello world')
Source:stackexchange.com