Django RuntimeError: Event loop is closed with OpenAI #26969
Replies: 1 comment
-
The "Event loop is closed" error in Django applications often occurs due to improper management of asynchronous tasks and event loops. Here are some potential causes and solutions:
Here is an example of how you might configure Gunicorn with Uvicorn: gunicorn myproject.asgi:application -k uvicorn.workers.UvicornWorker
By addressing these potential issues, you can mitigate the "Event loop is closed" error in your Django application. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.
System Info
asgiref==3.8.1
Django==5.1.1
gunicorn==23.0.0
packaging==24.1
python-decouple==3.8
sqlparse==0.5.1
tzdata==2024.2
whitenoise==6.7.0
Beta Was this translation helpful? Give feedback.
All reactions