我正在使用这个 python 应用程序的 dockerized 版本。
https://github.com/tunl/cast-sh/blob/dev/cast/app.py
主页加载正确。但是在输入默认密码“admin”后,出现错误。
[2021-04-30 15:07:23,451] ERROR in app: Exception on /cast [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
TypeError: wrapper() missing 1 required positional argument: 'fn'
不确定这个错误是否与docker或flask有关。
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
答案 0 :(得分:1)
我认为在文件 "routes.py", line 41 中缺少装饰器后面的括号。
它应该如下所示,因为装饰器允许可选参数,否则函数将无法正确包装。
@http.route("/cast")
@jwt_required()
def index():
# ...