Django报错Forbidden (CSRF cookie not set.)

Django使用Postman发送POT请求报错:

Forbidden (CSRF cookie not set.): /book/1/100/
[18/Jan/2022 11:34:38] “POST /book/1/100/ HTTP/1.1” 403 2801

 

解决:

setting:

注释: #’django.middleware.csrf.CsrfViewMiddleware’,

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
     #'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]