From 00b31663c29968bd50282d22fca9b95c09e4becf Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Sun, 14 May 2023 11:00:44 +0100 Subject: [PATCH] Upgrade dependencies in Django server example --- examples/server/wsgi/django_socketio/README.md | 18 ++++++++++++++---- .../wsgi/django_socketio/requirements.txt | 14 +++++++++----- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/examples/server/wsgi/django_socketio/README.md b/examples/server/wsgi/django_socketio/README.md index 9fcbabeb..b4659f47 100644 --- a/examples/server/wsgi/django_socketio/README.md +++ b/examples/server/wsgi/django_socketio/README.md @@ -9,8 +9,18 @@ You can run it with the Django development web server: python manage.py runserver ``` -When running in this mode, you will see a warning indicating that the WebSocket -transport is not available, which is not supported by this web server. +When running in this mode, you will get an error message: -See the documentation for information on supported deployment methods that you -can use to add support for WebSocket. + RuntimeError: Cannot obtain socket from WSGI environment. + +This is expected, and it happens because the Django web server does not support +the WebSocket protocol. You can ignore the error, as the server will still work +using long-polling. + +To run the application with WebSocket enabled, you can use the Gunicorn web +server as follows: + + gunicorn -b :8000 --threads 100 --access-logfile - django_socketio.wsgi:application + +See the documentation for information on other supported deployment methods +that you can use to add support for WebSocket. diff --git a/examples/server/wsgi/django_socketio/requirements.txt b/examples/server/wsgi/django_socketio/requirements.txt index 0ed6894f..e58991b7 100644 --- a/examples/server/wsgi/django_socketio/requirements.txt +++ b/examples/server/wsgi/django_socketio/requirements.txt @@ -1,7 +1,11 @@ -asgiref==3.5.2 +asgiref==3.6.0 backports.zoneinfo==0.2.1 -bidict==0.22.0 -Django==4.1.9 -python-engineio==4.3.2 -python-socketio==5.6.0 +bidict==0.22.1 +Django==4.2.1 +gunicorn==20.1.0 +h11==0.14.0 +python-engineio==4.4.1 +python-socketio==5.8.0 +simple-websocket==0.10.0 sqlparse==0.4.4 +wsproto==1.2.0