springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-19 13:40:16
144
我试图在表单上使用csrf保护,但总是收到一个错误,说我缺少csrf会话令牌。
我不知道我的代码出了什么问题,也许这里有人可以帮助我理解我做错了什么。
我的代码:
app = Flask(__name__)
csrf = CSRFProtect(app)
@app.route("/reserve", methods=["GET", "POST"])
def reserve():
if request.method == "GET" :
return render_template("reserve.html", csrf_token=generate_csrf())
<form id="Reserve" action="/reserve" method="post">
<!-- csrf protection -->
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"/>
<input type="text" placeholder="Name">
<button type="submit">
Submit
</button>
</form>
我尝试使用: 但它仍然不起作用。
顺晟科技:
我想您忘记为应用程序设置密钥。
app = Flask(__name__)
csrf = CSRFProtect(app)
@app.route("/reserve", methods=["GET", "POST"])
def reserve():
if request.method == "GET" :
return render_template("reserve.html", csrf_token=generate_csrf())
<form id="Reserve" action="/reserve" method="post">
<!-- csrf protection -->
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"/>
<input type="text" placeholder="Name">
<button type="submit">
Submit
</button>
</form>
app = Flask(__name__)
csrf = CSRFProtect(app)
@app.route("/reserve", methods=["GET", "POST"])
def reserve():
if request.method == "GET" :
return render_template("reserve.html", csrf_token=generate_csrf())
<form id="Reserve" action="/reserve" method="post">
<!-- csrf protection -->
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"/>
<input type="text" placeholder="Name">
<button type="submit">
Submit
</button>
</form>
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11