0

当我使用https://stackoverflow.com/a/13821624/3164117博客文章app.wsgi_app = DebuggedApplication(app)推荐的代码时,我得到一个格式精美的错误,Flask 调试器可以完美显示。没有那行代码,就没有错误,我现有的代码也可以正常工作。

确切的错误是:

File "/Users/DanielFranklin/Desktop/etch/etchcode/lib/flask/app.py", line 1969, in __call__
    return self.wsgi_app(environ, start_response)
File "/Users/DanielFranklin/Desktop/etch/etchcode/lib/werkzeug/debug/__init__.py", line 166, in __call__
    if request.args.get('__debugger__') == 'yes':
File "/Users/DanielFranklin/Desktop/etch/etchcode/lib/werkzeug/utils.py", line 71, in __get__
    value = self.func(obj)
File "/Users/DanielFranklin/Desktop/etch/etchcode/lib/werkzeug/wrappers.py", line 429, in args
    cls=self.parameter_storage_class)
File "/Users/DanielFranklin/Desktop/etch/etchcode/lib/werkzeug/urls.py", line 723, in url_decode
    include_empty, errors))
File "/Users/DanielFranklin/Desktop/etch/etchcode/lib/werkzeug/datastructures.py", line 373, in __init__
    for key, value in mapping or ():
File "/Users/DanielFranklin/Desktop/etch/etchcode/lib/werkzeug/urls.py", line 779, in _url_decode_impl
    key = url_unquote_plus(key, charset, errors)
File "/Users/DanielFranklin/Desktop/etch/etchcode/lib/werkzeug/urls.py", line 545, in url_unquote_plus
    return url_unquote(s, charset, errors)
File "/Users/DanielFranklin/Desktop/etch/etchcode/lib/werkzeug/urls.py", line 522, in url_unquote
    rv = _unquote_to_bytes(string, unsafe)
File "/Users/DanielFranklin/Desktop/etch/etchcode/lib/werkzeug/urls.py", line 351, in _unquote_to_bytes
    if isinstance(string, text_type):
RuntimeError: maximum recursion depth exceeded while calling a Python object
4

1 回答 1

1

正如您在引用的帖子中所引用的那样,它应该是app.wsgi_app = DebuggedApplication(app.wsgi_app, True),而不是您所说的app.wsgi_app = DebuggedApplication(app)--请注意,您忘记了True第二个参数(我认为是次要问题),并且更令人信服的是,您是在包装app自己,而不是app.wsgi_app按照应有的包装- - 你犯的后一个错误似乎确实可能导致你观察到的失控递归。

于 2016-01-04T01:17:04.813 回答