Django 使用form表单提交数据报错: Forbidden (403)
- Issue: 使用
from
表单submit之后报错入下:
- Action: 把django工程文件的
setting.py
中的'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',
]
重新运行效果如下: