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)

posted @ 2015-11-09 22:21  lyjsy  阅读(2855)  评论(0编辑  收藏  举报