BlaBla: a Django web chat application
Claire Pritchard
October 2016 - January 2018
BlaBla is a Django web chat application that makes use of websockets for updates and SSL/HTTPS.
When websockets are not available (in Safari when using a self-signed certificate, for example) or javascript is unavailable or disabled, the page can still be updated manually.
Features
- Real-time updates with the use of websockets (django-websocket-redis)
- Showing chats in chronological or reverse chronological order
- Persistence of chats in SQLite3 database
- Django REST framework views
- "Chat like a pirate" filter, which was added for International Talk Like a Pirate Day
Configuration
Django-sslserver was used to test the initial version on Windows, but when websockets were added it was necessary to switch to uWSGI on Linux (uWSGI is unavailable for Windows).
Before installing uWSGI install the following:
- build-essential python
- libpcre3 libpcre3-dev
- libssl-dev
Running BlaBla with uWSGI
Start redis-server and uwsgi with
sudo service redis-server start
sudo -u <user> nohup uwsgi --ini uwsgi.ini
Sample uwsgi.ini:
[uwsgi]
gevent = 100
http-websockets=True
module = blabla.wsgi:application
static-map = /static=/path/to/staticdir
https = =0,mycert.crt,mycert.key,HIGH
shared-socket = 0.0.0.0:<port>
virtualenv = /path/to/virtualenv
master=True