文章詳情頁
python - Flask內如何跳轉至其他頁面。
瀏覽:251日期:2022-09-03 11:10:20
問題描述
為了能從當前的路由跳轉至其他路由,我如下寫的:
@app.route(’/’,methods=[’POST’,’GET’])def index(): if request.args.get(’data’,type=int)==1: #判斷是否前往return redirect(url_for(’about’)) return render_template(’index.html’)@app.route(’/about’) def about(): : :return render_template(’about.html’)
但是沒有用,然后我又改成:
return render_template(’about.html’)
然后依然沒用,頁面都不會跳轉 (肯定進了if的)現在很茫然,不知道怎么辦 求教
問題解答
回答1:加個點
redirect(url_for('.about'))
相關文章:
1. docker - 各位電腦上有多少個容器啊?容器一多,自己都搞混了,咋辦呢?2. 關docker hub上有些鏡像的tag被標記““This image has vulnerabilities””3. mac里的docker如何命令行開啟呢?4. 關于docker下的nginx壓力測試5. Docker for Mac 創建的dnsmasq容器連不上/不工作的問題6. nignx - docker內nginx 80端口被占用7. docker容器呢SSH為什么連不通呢?8. 如何解決Centos下Docker服務啟動無響應,且輸入docker命令無響應?9. docker start -a dockername 老是卡住,什么情況?10. dockerfile - 我用docker build的時候出現下邊問題 麻煩幫我看一下
排行榜

網公網安備