# django-live /

Filename Size Date modified Message
demo
live
156 B
34.3 KB
4.2 KB
2.1 KB

Author: NicoEchaniz (nico@rakar.com)

django-live is a little application packaged for Django that adds comet(push) based chat capabilities to your project.

The current features are: - public chat rooms - guests allowed - public chat rooms for registered users - live help -> similar to PHPLive or HumanClick (only the chat functionality implemented so far)

## Requirements

You need orbited>=0.7.11beta2 [0] installed and Morbid properly configured.

## Setup

### Orbited

You need to set up your orbited.cfg file to allow access to your STOMP broker port. You could add, for example (that's the standard port): [access] * -> localhost:61613

if you are accessing the orbited server through a public domain, you will need to change this to something like: * -> yourdomain.com:61613

To configure Morbid you may uncomment the stomp line in the orbited.cfg file to have it run automatically. You will also need to change the default orbited port if you will be running Django's web server on port 8000.

[listen] http://:9000 stomp://:61613 stomp.cfg

### Django

ORBITED_HOST = "localhost" # (use the domain name you used for orbited access). defaults to localhost ORBITED_PORT = "9000" # defaults to 9000 STOMP_PORT = "61613" # defaults to 61613

STOMP_RESTQ_URL = "/live/restq/"

Beware that the restq URL takes into account the domain set for the Site object obtained from django's get_current_site. So you MUST set that value correctly for Morbid to work.

This last setting must correspond to the setting in your stomp.cfg file. See below.

And edit your project's urls.py to include live.urls. For example, you could add this line:

(r'live/', include('live.urls')),

If you do not use 'live/' as the "mount point" for django-live urls you will need to update this accordingly.

### Stomp

You need to create a stomp.cfg file telling Morbid where to access django-live RestQ

If you are accessing django on localhost port 8000 and you used 'live/' as your django-live "mount point" in your urls file, you need to add this line to your stomp.cfg file.

Don't forget to edit the corresponding Site in your database and set it's domain value accordingly.

Modify it as needed, to reflect your setup.

## Usage

Orbited will have to be running in order to use django-live. You normally run it from your project path (where your orbited.cfg and stomp.cfg files live) like so:

$orbited --config orbited.cfg The following URL examples assume you are running the django web server on the standard port, you should strip the ":8000" part if you are serving your app on port 80 (from apache or any other server). Asuming you have used the sample config from above, you may access the diferent features like this: Open or join the default "public" chat room: localhost:8000/live Open or join a named public chat room: localhost:8000/live/public/room_name Open or join a named chat room for logged in users only: localhost:8000/live/chat/room_name The generated channel names will be visible to the manager, who will then be able to asist the guests by clicking on each channel link. Monitor what channels are open using: localhost:8000/live/manage ## Demo If you want to see how django-live works, you may run the included demo django project. Just open a terminal in the demo folder and run:$ orbited --config orbited.cfg then open a second terminal in the same location and run # ./manage.py runserver

Now browse through the URLs described in the previous section.

django-live expects a live/base.html template to exist so you can override this template in your own project/app to inegrate the chat functionality.

## Testing

django-live uses lettuce, selenium and Firefox for testing.

With these dependencies installed you can run the tests from the demo/ folder with the command

\$ ./manage.py harvest ../live/features

You should have no open Firefox processes when running the tests.

That's it so far.

Feel free to contact me with suggestions

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.