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
原文:http://www.cnblogs.com/sywlneu/p/4951405.html