Skip to content
An experiment in mixing up django and twisted
Python JavaScript
Find file
Latest commit e3dbf9f Nov 6, 2013 @aausch test

Partially implemented chat server.

(An experiment in using twisted with websockets, with a site served by Django.)

(Django serves the static/http pages, by default on port 8000 on localhost, while twisted handles the chat server, by default on port 1025 on localhost)


  • Start this as a standard django project (./ runserver)
    • don't forget to do fun things like syncdb before starting
  • Create a chat room through django's admin interface (localhost:8080/admin/)
  • "twistd -y", though probably "twistd -n -y" is more appropriate since you're likely not going to use this for production at any time

To see the chat service in action:

  • a list of existing chat rooms is at localhost:8000/chats
  • chat over websockets at localhost:8000/chats/[room_id]
  • chat over HTTP, with a long-polling service, at localhost:8000/chats/long_poll/[room_id]


Note that I'm relying on the websockets branch (I used websocket-4173-4) of twisted, so make sure to install that (I don't think it's merged into the main branch yet)

See requirements.txt for versions of dependencies.

I've been running things in a standard python2.7 virtualenv, with pip for package management


  • Integrate twisted and django authentication
  • have twisted log chats to django's database
  • nice ui for creating chat rooms, etc....
Something went wrong with that request. Please try again.