问题描述
我想弄清楚为什么 Flask 交互式调试器不工作.我的模板应用程序是准系统,只有一个错误:
I'm trying to figure out why the Flask interactive debugger isn't working. My template application is barebones, with a single error:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
print missing_variable #Error
return 'Hello World!'
if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True)
但是调试器捕获了错误,但给了我一个非交互式页面并抱怨缺少 Javascript:
But the debugger catches the error, but gives me a non-interactive page and complains about a lack of Javascript:
调试器在您的 WSGI 应用程序中捕获到异常.您现在可以查看导致错误的回溯.如果您启用 JavaScript,您还可以使用其他功能,例如代码执行(如果启用了 evalex 功能)、自动粘贴异常等等.
我没有禁用 Javascript,所以我不确定为什么交互式调试器坏了.谢谢!
I haven't disabled Javascript, so I'm not sure why this the interactive debugger is broken. Thanks!
我在远程主机上运行它并通过 SSH 隧道查看它.是否有可能以这种方式禁用 Javascript?
I'm running this on a remote host and viewing this over an SSH tunnel. Is it possible that Javascript is disabled in this way?
推荐答案
解决方案是没有找到调试器提供的作为 Werkzeug 套件一部分的静态文件.只需卸载/重新安装 Flask 和 Werkzeug 即可解决此问题.感谢所有回答的人!
The solution was that none of the static files provided by the debugger as part of the Werkzeug suite were being found. Simply uninstalling/reinstalling Flask and Werkzeug fixed this issue. Thanks for everyone who answered!
这篇关于Flask 交互式调试器损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!