Dr.Neos 2019-05-17 10:28 采纳率: 0%
浏览 561
已结题

一筹莫展 Django显示 MultiValueDictKeyError at /myDetector/

我试过很多办法了 都没法解决 哥哥们帮忙看看

图片说明

代码见下
mainDealer()函数
def mainDealer(request):
# post = request.POST.items()
print("rawTarget =", request.POST["rawTarget"])
target = reverse("myDetector:tempTest") + '?'
argName = request.POST["paramName"]
argPath = argName.split("?")[0]
argName = argName.split("?")[1]
# dealt by model
lmModel = Judger.readModelFromFile(name=Judger.getFileName(
argName, "2018119", "lm"), obj_hook=Judger.lmFromFile)
cmModel = Judger.readModelFromFile(name=Judger.getFileName(
argName, "2018119", "cm"), obj_hook=Judger.cmFromFile)
lmPredictRst = lmModel.predict(
samples=[
request.POST["paramValue"]],
realRst=[])
cmPredictRst = cmModel.predict(
samples=[
request.POST["paramValue"]],
realRst=[])
judgeRst = {"lm": lmPredictRst[0], "cm": cmPredictRst[0]}
if not judgeRst["lm"]:
addNewMarkedValue(argName, request.POST["paramValue"], "lm", argPath)
if not judgeRst["cm"]:
addNewMarkedValue(argName, request.POST["paramValue"], "cm", argPath)
#
request.session["argName"] = argName
request.session["argPath"] = argPath
request.session["argValue"] = request.POST["paramValue"]
request.session["ip"] = request.META['REMOTE_ADDR']
request.session["judgeRst"] = judgeRst
request.session["rawTarget"] = request.POST["rawTarget"]
target = target[:-1]
return HttpResponseRedirect(target)

urlpatterns = [
url(r'^$', views.mainDealer, name='mainDealer'),
url(r'^tempTest/$', views.tempTest, name='tempTest'),
url(r'^showModels/$', views.showModels, name='showModels'),
url(r'^delOneMarkedValue/$', views.dealMv),
url(r'^reTrain/$', views.reTrain),
url(r'^machineClassificationRst/$', views.readMLClassificationRst),
url(r'^dealMLClassificationRst/$', views.dealMLClassificationRst),
url(r'^xssIntoDb/$', views.xssIntoDb, name='xssIntoDb'),
url(r'^xssDetectorPage/$', views.xssDetectorPage, name='xssDetectorPage'),
url(r'^readXss/$', views.readXss, name='readXss'),
url(r'^xssStateChange/$', views.xssStateChange, name='xssStateChange'),
]

试了request.POST.get() 没有用 依旧报错

  • 写回答

2条回答 默认 最新

  • dabocaiqq 2019-05-17 17:49
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决