Browse Source

Merge pull request #263 from charleswhchan/update-examples

Update examples to match with documentation
django-2.1.8
Jacob Rief 3 years ago
committed by GitHub
parent
commit
abcddaad2f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 3 deletions
  1. +6
    -1
      examples/wsgi.py
  2. +11
    -1
      examples/wsgi_django.py
  3. +17
    -1
      examples/wsgi_websocket.py

+ 6
- 1
examples/wsgi.py View File

@ -1,5 +1,10 @@
# test uWSGI with low traffic:
# Django with Websocket for Redis under a single uWSGI server
# (for sites with low traffic)
#
# uwsgi --virtualenv /path/to/virtualenv --http :9090 --gevent 100 --http-websockets --module wsgi
#
# See: http://django-websocket-redis.readthedocs.io/en/latest/running.html#django-with-websockets-for-redis-as-a-stand-alone-uwsgi-server
import os
import sys
sys.path.insert(0, os.path.abspath('..'))


+ 11
- 1
examples/wsgi_django.py View File

@ -1,3 +1,13 @@
# entry point for the Django loop
# Django with WebSockets for Redis behind NGiNX using uWSGI
# (for sites requiring scalability)
#
# Note: this is entry point for the Django loop
#
# uwsgi --virtualenv /path/to/virtualenv --socket /path/to/django.socket --buffer-size=32768 --workers=5 --master --module wsgi_django
#
# See: http://django-websocket-redis.readthedocs.io/en/latest/running.html#django-with-websockets-for-redis-behind-nginx-using-uwsgi
import os
os.environ.update(DJANGO_SETTINGS_MODULE='chatserver.settings')
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

+ 17
- 1
examples/wsgi_websocket.py View File

@ -1,6 +1,22 @@
# entry point for the websocket loop
# Django with WebSockets for Redis behind NGiNX using uWSGI
# (for sites requiring scalability)
#
# Note: this is entry point for the websocket loop
#
# uwsgi --virtualenv /path/to/virtualenv --http-socket /path/to/web.socket --gevent 1000 --http-websockets --workers=2 --master --module wsgi_websocket
#
# See: http://django-websocket-redis.readthedocs.io/en/latest/running.html#django-with-websockets-for-redis-behind-nginx-using-uwsgi
import gevent.monkey
gevent.monkey.patch_thread()
from ws4redis.uwsgi_runserver import uWSGIWebsocketServer
application = uWSGIWebsocketServer()
import os
import gevent.socket
import redis.connection
redis.connection.socket = gevent.socket
os.environ.update(DJANGO_SETTINGS_MODULE='chatserver.settings')
from ws4redis.uwsgi_runserver import uWSGIWebsocketServer
application = uWSGIWebsocketServer()

Loading…
Cancel
Save