【发布时间】:2019-03-04 11:17:27
【问题描述】:
我正在使用 psycopg2 访问 django 项目中的 postgresql 数据库。执行一个大约需要 30 分钟的函数,然后将结果保存到数据库中时 出现以下异常
self.connection.autocommit = autocommit Internal Server Error:
/dashboard/ajax/playbookRunner/39 Traceback (most recent call last):
File "env/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 238, in _set_autocommit
self.connection.autocommit = autocommit psycopg2.InterfaceError: connection already closed
有什么想法吗?
Django==2.1.5, psycopg2==2.7.7 psycopg2-binary==2.7.7, psql (PostgreSQL) 版本为10.6
【问题讨论】:
-
分享一些代码