You can use the csrf_exempt
decorator to disable CSRF protection for a particular view.
Say your url pattern is:
('^my_page/$', direct_to_template, {'template': 'my_page.html'})
Add the following import to your urls.py
:
from django.views.decorators.csrf import csrf_exempt
Then change the url pattern to:
('^my_page/$', csrf_exempt(direct_to_template), {'template': 'my_page.html'})
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…