文章詳情頁
python - Flask內(nèi)如何跳轉(zhuǎn)至其他頁面。
瀏覽:143日期:2022-09-03 11:10:20
問題描述
為了能從當(dāng)前的路由跳轉(zhuǎn)至其他路由,我如下寫的:
@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’)
然后依然沒用,頁面都不會跳轉(zhuǎn) (肯定進(jìn)了if的)現(xiàn)在很茫然,不知道怎么辦 求教
問題解答
回答1:加個(gè)點(diǎn)
redirect(url_for('.about'))
相關(guān)文章:
1. Docker for Mac 創(chuàng)建的dnsmasq容器連不上/不工作的問題2. docker安裝后出現(xiàn)Cannot connect to the Docker daemon.3. 關(guān)于Android權(quán)限的獲取問題,大家遇到過這樣的情況嘛?4. javascript - 編程,算法的問題5. javascript - 怎么看網(wǎng)站用了什么技術(shù)框架?6. java報(bào)錯Communications link failure 該如何解決?7. javascript - 請教空白文本節(jié)點(diǎn)的問題8. 刷新頁面出現(xiàn)彈框9. android - 七牛單次上傳單張圖片,11次6次上傳失敗10. css - 關(guān)于border-image
排行榜

熱門標(biāo)簽