Michele, > ... the database connection seems to shut down randomly.
Could be the same problem as I described in Database "InterfaceError connection already closed" with asgi. https://groups.google.com/g/django-users/c/RmtFuCVLfPE/m/dBQjq7FsBQAJ Django doesn't stick to the same thread (sync_to_async with thread_sensitive=False) when generating a response for exceptions. I haven't studied Django internals, but it seems that it might be better to use thread_sensitive=True and try to keep using the database connection prepared for the current request in the current thread. Regards, Peter Wagemans -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/AM9PR01MB7412C99DBA425D4B02E8D5319DFB9%40AM9PR01MB7412.eurprd01.prod.exchangelabs.com.

