How to disable Django's CSRF validation?

前端 未结 9 1335
梦毁少年i
梦毁少年i 2020-11-30 21:23

I have commented out csrf processor and middleware lines in settings.py:

122 
123 TEMPLATE_CONTEXT_PROCESSORS = (
124     \'django.contrib.auth.         


        
9条回答
  •  Happy的楠姐
    2020-11-30 22:24

    CSRF can be enforced at the view level, which can't be disabled globally.

    In some cases this is a pain, but um, "it's for security". Gotta retain those AAA ratings.

    https://docs.djangoproject.com/en/dev/ref/csrf/#contrib-and-reusable-apps

提交回复
热议问题