python - Flask 应用程序随机抛出内部服务器错误
问题描述
我已经设置了一个烧瓶应用程序,它从我的 Postgres 获取数据(使用 psycopg2)并在点击相关 URL 时以 JSON 格式返回它。它在大多数情况下都能正常工作,但在随机执行次数后它会返回:
**Internal Server Error**
The server has encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
该应用程序托管在 EC2 t2.micro 中,而 Postgres 是 AWS RDS。任何想法将不胜感激。
更新
在 EC2 日志中,我看到了以下 Psycopg2 错误
psycopg2.InternalError: current transaction is aborted, commands ignored until end of transaction block
查询中似乎有错误,但不应该是因为它在大多数情况下都能正常运行。
解决方案
推荐阅读
- visual-studio-2019 - Visual Studio 2019 非常慢并且在添加文件夹或添加 cs 时第二次没有响应
- c# - 如何使用 dbcontext 使用实体框架核心插入一条或多条记录(soap ui 通过 api 调用将数据发送到 asp.net 核心)
- c++ - 如何使用 ArrayFromJSON 创建日期箭头数组
- r - 闪亮的测验问题
- matlab - 使用 Simscape 操纵器进行计算扭矩控制
- git - git repo 中缺少一行
- c# - ASP.Net HttpPostedFileBase 缺少参考
- javascript - npm 的 docker-compose up 失败
- python - django url 可以在开头包含固定路径吗?
- android - 如何使用绑定适配器从 ImageView 中的 drawable 加载动画 gif?