Ber*_*nho 3 python flask twitter-bootstrap
我对 Python 和 Flask 相当陌生,但我正在上课,对于我们的最终项目,我们将构建一个简单的站点。
我在我的 views.py 类中添加了一堆路由,但我一生都无法理解错误。错误标记后没有任何内容,因此我无法删除任何内容。如果我删除完整评论,错误只会不断上升。不幸的是,我的 google-fu 背叛了我,因此我终于在这里注册,而不仅仅是潜伏。
我会将完整的 views.py 发布为 pastebin:http : //pastebin.com/Te6tkD7q
问题出现在第 92 行的 addToJson def 的注释之后。
# This function takes in a dictionary and writes those values to the specified database, in this case techDB.json
Run Code Online (Sandbox Code Playgroud)
def addToJson (_dictionary): checkData()
with open(filename+".json", 'r+') as infile:
data = json.load(infile)
infile.close()
pass
data['techs'].append(_dictionary["techs"][0])
with open(filename+".json", "w") as outfile:
json.dump(data, outfile)
outfile.close()
pass
print("Technique has been added.")
pass
Run Code Online (Sandbox Code Playgroud)
该项目是使用 Visual Studio 和 Python 工具在虚拟环境中创建的,如果这很重要的话。
感谢您的时间
第 89 行:
return jsonify(GetJsonTech(techname)
Run Code Online (Sandbox Code Playgroud)
缺少最后的最后关闭)所以需要更改为
return jsonify(GetJsonTech(techname))
Run Code Online (Sandbox Code Playgroud)