Hotdot - Realtime webapp using Django + Orbited + Twisted
What is Hotdot?
A very complete example of how to a create a realtime web application using Django + Orbited + Twisted.
Read more about the motivation behind Hotdot: http://clemesha.org/blog/2009/dec/17/realtime-web-apps-python-django-orbited-twisted
Currently the example is: Realtime Voting Both: Collaborative Realtime Voting, Chatting, and Editing Polls.
Is Hotdot a 'Realtime Web Framework'?
Not currently. Maybe it should turn into one? UPDATE [12/27/2009]: I've started work on making Hotdot more "framework" like. That is, I'm making it easier to "plug in" your own application logic, etc, by following a small set of conventions. The work-in-progress code is in this branch: http://github.com/clemesha/hotdot/tree/framework
For comparison, consider Tornado (http://www.tornadoweb.org), which is the 'realtime web framework' used to build FriendFeed. Tornado is minimal and clean, and does include some very nice features beyond just being a non-blocking webserver.
My proposition with Hotdot is that the combination of Django, Orbited, and Twisted results in a more 'full-featured realtime web framework', with a greater community and total features, than can be found in Tornado.
How and Why?
The combination of Django + Orbited + Twisted is everything you need to make a 'real-world' realtime web application with Python.
- Their roles:
- Django: Excellent web framework for creating the backbone of a great web application.
- Orbited: Realtime web (Comet) library to build the realtime components with.
- Twisted: Scalable asynchronous network lib, for serving Orbited (and Django too, with WSGI!)
- Other reasons for Hotdot:
- Incorporate core bits into http://codenode.org (http://github.com/codenode/codenode) to make it realtime.
- My personal education on this awesome topic.
Install
Recommended: Use a
virtualenv
and install withpip
, to get them type:easy_install virtualenv pip
Create a fresh
virtualenv
:virtualenv --no-site-packages hotdot_env
Install dependencies into your
virtualenv
:#You must have Django 1.0+ and Twisted 9.0+ pip -E hotdot_env install -U django orbited twisted simplejson
Move into your
virtualenv
and activate it:$ cd hotdot_env $ source bin/activate
Get a copy of Hotdot from here:
curl http://github.com/clemesha/hotdot/tarball/master #Or clone a copy: $ git clone git://github.com/clemesha/hotdot.git
Usage
In the directory
hotdot/djangoweb
, type:django-admin.py syncdb --pythonpath='.' --settings='settings'
In the toplevel directory
hotdot
, type:twistd -ny server.py
- Now open browser to http://localhost:8000/
- Also see settings in server.py and djangoweb/settings.py
- To change host interface, see server.py->INTERFACE and djangoweb/settings.py->INTERFACE.
Tests
In the directory
hotdot/djangoweb
, type:django-admin.py test --pythonpath='.' --settings='settings'
Details of how Hotdot works
(WORK IN PROGRESS)
- Orbited as a Twisted Service
- Django running from twisted.web.wsgi
- Authentication using Twisted Cred+Django models
- Filtering + modification + logging of in-transit Orbited messages
- STOMP as the default, example protocol.
Why the name Hotdot?
'Hot' as in the latest goodness. 'Dot' as in _D_jango + _O_rbited + _T_wisted.
License, Questions, Contact
Hotdot is licensed under the BSD. Please fork a copy here!: http://github.com/clemesha/hotdot Contact: Alex Clemesha <[email protected]> | http://twitter.com/clemesha