I have a management command running on an EC2 instance which fails when trying to execute ORM queries like so:
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 53, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 899, in execute_sql
raise original_exception
OperationalError: SSL connection has been closed unexpectedly
I can connect to the same database just fine from a django-admin shell_plus
on the same instance.
To diagnose this, I'd like to inspect the parameters of the connection request Django is making in each case, to see what's different, but after a bit of poking through the Django source it seemed best to ask how rather than getting lost in the weeds for hours :)
alternate strategies for diagnosing this also welcome!