"C:\Anaconda 3.8\python.exe" C:\Users\D2022\Desktop\h\main.py * Serving Flask app 'models' * Debug mode: off WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Running on http://127.0.0.1:5000 Press CTRL+C to quit C:\Users\D2022\Desktop\h\main.py:95: LegacyAPIWarning: The Query.get() method is considered legacy as of the 1.x series of SQLAlchemy and becomes a legacy construct in 2.0. The method is now available as Session.get() (deprecated since: 2.0) (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9) datas = models.User.query.get(stu_id) [2023-06-01 23:57:48,782] ERROR in app: Exception on / [GET] Traceback (most recent call last): File "C:\Anaconda 3.8\lib\site-packages\flask\app.py", line 2190, in wsgi_app response = self.full_dispatch_request() File "C:\Anaconda 3.8\lib\site-packages\flask\app.py", line 1486, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Anaconda 3.8\lib\site-packages\flask\app.py", line 1484, in full_dispatch_request rv = self.dispatch_request() File "C:\Anaconda 3.8\lib\site-packages\flask\app.py", line 1469, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "C:\Users\D2022\Desktop\h\main.py", line 100, in index return render_template('projects/table_s.html', datas=datas, results=results) File "C:\Anaconda 3.8\lib\site-packages\flask\templating.py", line 151, in render_template return _render(app, template, context) File "C:\Anaconda 3.8\lib\site-packages\flask\templating.py", line 132, in _render rv = template.render(context) File "C:\Anaconda 3.8\lib\site-packages\jinja2\environment.py", line 1301, in render self.environment.handle_exception() File "C:\Anaconda 3.8\lib\site-packages\jinja2\environment.py", line 936, in handle_exception raise rewrite_traceback_stack(source=source) File "C:\Users\D2022\Desktop\h\templates\projects\table_s.html", line 1, in top-level template code {% extends 'projects/base.html' %} File "C:\Users\D2022\Desktop\h\templates\projects\base.html", line 140, in top-level template code {% block content %} {% endblock %} File "C:\Users\D2022\Desktop\h\templates\projects\table_s.html", line 48, in block 'content' <td>{{resu.jingdian | jiequ(20)}}</td> File "C:\Users\D2022\Desktop\h\main.py", line 156, in jiequs if len(li) < num: TypeError: object of type 'NoneType' has no len() 127.0.0.1 - - [01/Jun/2023 23:57:48] "GET / HTTP/1.1" 500 -
时间: 2023-07-21 15:21:16 浏览: 241
Anaconda3-2022.10-Windows-x86-64.exe
这是一个 Python Flask web 应用程序的错误日志。从日志中可以看出,应用程序在处理一个 GET 请求时发生了异常。具体来说,应用程序在处理请求后尝试从数据库中获取一个名为 stu_id 的用户对象,但是在处理时出现了一个 LegacyAPIWarning,提示 Query.get() 方法已经被视为过时,建议使用 Session.get() 方法。然后,在渲染一个名为 table_s.html 的模板时,应用程序尝试使用 jiequ() 函数将特定字段的值截取为指定长度,但是在执行 jiequ() 函数时出现了一个 TypeError,提示 NoneType 对象没有 len() 方法。这可能是因为 jiequ() 函数的参数 li 是空值。需要检查代码中的 jiequ() 函数,确保 li 参数不为空。
阅读全文