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',
]

重新运行效果如下:

posted @ 2018-10-21 17:06  LuckyZLi  阅读(213)  评论(0编辑  收藏  举报