文章详情页
python - Flask内如何跳转至其他页面。
浏览:282日期: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. android - Home键app重新启动的问题2. 前端 - html5 audio不能播放3. javascript - 求助这种功能有什么好点的插件?4. 关docker hub上有些镜像的tag被标记““This image has vulnerabilities””5. 自学,刚编了helloworld就失败了6. javascript - 求助一个关于indexedDB的问题7. 请问PHPstudy中的数据库如何创建索引8. Python 爬虫字符编码问题,求解。9. python3.x - mongodb 显示不出中文,都是方块,该如何解决?10. python - Pycharm调试代码进行列表遍历时,如何直接赋值指定元素
排行榜

网公网安备