gpt4 book ai didi

python - psycopg2.InterfaceError : connection already closed

转载 作者:太空宇宙 更新时间:2023-11-04 04:18:31 25 4
gpt4 key购买 nike

我正在使用 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

最佳答案

使用 WSGI 部署解决了问题这里是文档的链接 https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/

关于python - psycopg2.InterfaceError : connection already closed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54982151/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com