Pzwjack1995 2017-04-24 02:56 采纳率: 33.3%
浏览 5063

python flask框架Bad Request问题

from KNN import *
from flask import Flask,request,render_template

app = Flask(__name__)

@app.route('/',methods=['GET','POST'])
def home():
return render_template('web.html')

@app.route('/training',methods=['GET','POST'])
def training():
pos_path = request.form['positivepath']
neg_path = request.form['negativepath']
Precision,A,B,C,D = algorithm()
return render_template('result.html',precision=Precision,posright=A,poswrong=B,negright=C,negwrong=D)

if name == '__main__':
app.run()

    代码如上,运行后输入localhost:5000能到达web.html,但是提交表单后无法到result.html页面,总是提示Bad Request

The browser (or proxy) sent a request that this server could not understand.

  • 写回答

1条回答

  • BBIE 2018-11-12 04:07
    关注

    有可能是form表达里面的数据不全,def里面没有拿到想要的值

    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大