文章详情页
python - Flask内如何跳转至其他页面。
浏览:246日期: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-machine添加一个已有的docker主机问题2. nignx - docker内nginx 80端口被占用3. javascript - 移动端 点击弹出遮罩层 加断点调试就行 不加断点就不行4. javascript - 正则匹配字符串特定语句后的数字5. 关于docker下的nginx压力测试6. angular.js使用$resource服务把数据存入mongodb的问题。7. docker安装后出现Cannot connect to the Docker daemon.8. debian - docker依赖的aufs-tools源码哪里可以找到啊?9. docker images显示的镜像过多,狗眼被亮瞎了,怎么办?10. docker容器呢SSH为什么连不通呢?
排行榜

网公网安备