Browse Source

Merge pull request #1 from DaniilSezonov/master

Add django2.1.5 support
django-2.1.8
Vasilii T 2 years ago
committed by GitHub
parent
commit
e7477f49df
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      ws4redis/django_runserver.py

+ 6
- 1
ws4redis/django_runserver.py View File

@ -5,6 +5,7 @@ import select
import logging
from hashlib import sha1
from wsgiref import util
import django
from django.core.wsgi import get_wsgi_application
from django.core.servers.basehttp import WSGIServer, ServerHandler as _ServerHandler, WSGIRequestHandler as _WSGIRequestHandler
from django.conf import settings
@ -94,7 +95,11 @@ class WebsocketRunServer(WebsocketWSGIServer):
logger.debug('WebSocket request accepted, switching protocols')
start_response(force_str('101 Switching Protocols'), headers)
six.get_method_self(start_response).finish_content()
return WebSocket(environ['wsgi.input'])
if (django.VERSION[:3] >= (2,1,5)):
wsgi_input = environ['wsgi.input'].stream
else:
wsgi_input = environ['wsgi.input']
return WebSocket(wsgi_input)
def select(self, rlist, wlist, xlist, timeout=None):
return select.select(rlist, wlist, xlist, timeout)


Loading…
Cancel
Save