django rest framework csrf failed csrf token missing or incorrect

django rest framework csrf failed csrf token missing or incorrect

 

REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': ('rest_framework.authentication.TokenAuthentication',)
}

 

or

MIDDLEWARE_CLASSES = (
'store.disable.DisableCSRF',
)

disable.py

class DisableCSRF(object):

    def process_request(self, request):
        setattr(request, '_dont_enforce_csrf_checks', True)

你可能感兴趣的:(django rest framework csrf failed csrf token missing or incorrect)