码迷,mamicode.com
首页 > 其他好文 > 详细

django中form表单post无法提交

时间:2019-03-26 01:05:16      阅读:331      评论:0      收藏:0      [点我收藏+]

标签:exe   djang   color   set   跳过   style   view   作用   增加   

报错403:Forbidden (CSRF token missing or incorrect.)

解决方法

方法一:

  把settings.py文件中含有csrf那一行注释掉

 

方法二:

1.导入csrf_exempt包

1 from django.views.decorators.csrf import csrf_exempt


2.增加装饰器@csrf_exempt

@csrf_exempt #增加装饰器,作用是跳过 csrf 中间件的保护

 

django中form表单post无法提交

标签:exe   djang   color   set   跳过   style   view   作用   增加   

原文地址:https://www.cnblogs.com/KevenLiu/p/10597508.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!