环境
Python3.7 + Django2.2.10
在 def 方法中配置
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def myview(request):
pass
在 urls.py 中配置
from django.conf.urls import url
from django.views.decorators.csrf import csrf_exempt
import views
urlpatterns = [
url(r'^myview/$', csrf_exempt(views.MyView.as_view()), name='myview'),
]