Django version: 1.11.11
This error occurred when you try to submit POST form via Postman 2 App
My temporary solution is disabling CSRF Checking by creating a custom middleware.
Just create a new file on the same folder with your settings.py file, let’s name it middleware.py and put these code:
from django.utils.deprecation import MiddlewareMixinfrom django.utils.deprecation import MiddlewareMixin class DisableCsrfCheck(MiddlewareMixin): def process_request(self, req): attr = '_dont_enforce_csrf_checks' if not getattr(req, attr, False): setattr(req, attr, True)
then add this on settings.py before django’s CSRF middleware:
'yourProjectName.middleware.DisableCsrfCheck',
source:
https://stackoverflow.com/questions/16458166/how-to-disable-djangos-csrf-validation