文章詳情頁
python - Flask內(nèi)如何跳轉(zhuǎn)至其他頁面。
瀏覽:142日期: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) (肯定進了if的)現(xiàn)在很茫然,不知道怎么辦 求教
問題解答
回答1:加個點
redirect(url_for('.about'))
相關(guān)文章:
1. mysql - AttributeError: ’module’ object has no attribute ’MatchType’2. php自學(xué)從哪里開始?3. javascript - 百度echarts series數(shù)據(jù)更新問題4. MySQL客戶端吃掉了SQL注解?5. 求大神幫我看看是哪里寫錯了 感謝細心解答6. javascript - JS設(shè)置Video視頻對象的currentTime時出現(xiàn)了問題,IE,Edge,火狐,都可以設(shè)置,反而chrom卻...7. javascript - 圖片能在網(wǎng)站顯示,但控制臺仍舊報錯403 (Forbidden)8. python小白的基礎(chǔ)問題 關(guān)于while循環(huán)的嵌套9. phpstady在win10上運行10. python - Django分頁和查詢參數(shù)的問題
排行榜

熱門標簽