Reputation: 31
I am using psycopg2 to access a postgresql database in a django project. When executing a function that takes around 30 minutes and then saving the results into database the following exception appears
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
any ideas?
Django==2.1.5, psycopg2==2.7.7 psycopg2-binary==2.7.7, and psql (PostgreSQL) version is 10.6
Upvotes: 2
Views: 6274
Reputation: 31
deployment with WSGI solved the problem here's the link for the docs https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
Upvotes: 1
Reputation: 75
sadly it happens in django version 1.3 and 1.4. Please check your postgres log for any detailed information. Upgrading django to recent version is recommended. Please post your django and postgres version.
Upvotes: 0