springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-19 13:47:56
184
我有一个简单的flask web应用程序,我想使用flask_wtf csrf保护,但是每当我试图运行提交表单时,我会得到一个错误,说我丢失了csrf令牌。
甚至有可能在没有wtf表单的情况下使用csrf吗? 如果是这样,我做错了什么?
我的代码:
app = Flask(__name__)
csrf = CSRFProtect(app)
@app.route("/reserve", methods=["GET", "POST"])
def reserve():
if request.method == "GET" :
return render_template("reserve.html", **context)
<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>
顺晟科技:
查看您的代码,您需要用csfr初始化应用程序,下面的示例:
app = Flask(__name__)
csrf = CSRFProtect(app)
@app.route("/reserve", methods=["GET", "POST"])
def reserve():
if request.method == "GET" :
return render_template("reserve.html", **context)
<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>
和HTML
app = Flask(__name__)
csrf = CSRFProtect(app)
@app.route("/reserve", methods=["GET", "POST"])
def reserve():
if request.method == "GET" :
return render_template("reserve.html", **context)
<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