{
"info": {
"author": "Vincenzo E. Antignano (@qubird)",
"author_email": "UNKNOWN",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 3 - Alpha",
"Framework :: Django",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License (GPL)",
"Programming Language :: Python"
],
"description": "====================\nDjango Chatrooms\n====================\n\nChatrooms is an app that provides multi-user chat rooms for your django site.\n\nIt's completely based on jQuery and `gevent `_, whose libraries\nhave been used to implement long polling.\n\nIt provides a set of models, views and templates ready out of the box and easily\ncustomizable.\n\n\nInstallation\n************\n\nInstall the egg from pypi::\n\n $ pip install django-chatrooms\n\nor get the latest revision from github::\n\n $ pip install -e git+git://github.com/qubird/django-chatrooms#egg=chatrooms\n\nIf you use buildout, just add ``django-chatrooms`` to your eggs part.\n\nThe egg setup takes care of installing all the needed dependencies, anyway you might need to install `greenlet `_ and `libevent `_ to let gevent work properly.\n \nOnce the egg is installed, add the following apps to your settings.INSTALLED_APPS::\n\n INSTALLED_APPS = (\n # ...,\n 'polymorphic',\n 'chatrooms',\n # ...,\n )\n\nThen include chatrooms urls to your urlpatterns::\n\n urlpatterns = patterns('',\n # ...,\n url(r'^chat/', include('chatrooms.urls')),\n # ...,\n )\n\nMake sure you also added ``staticfiles_urlpatterns`` to urlconf like::\n\n from django.contrib.staticfiles.urls import staticfiles_urlpatterns\n urlpatterns += staticfiles_urlpatterns()\n\nand ``'django.contrib.staticfiles'`` is amongst ``INSTALLED_APPS``.\n\nThen you're ready to run ``syncdb``.\n\n\nImportant Note\n**************\n\ndjango-chatrooms works properly in a multithreading environment (like `gevent patched wsgi server `_, or `uwsgi server with gevent plugin `_).\n\nTo use the app with servers that pre-fork the application before running, like \n`gunicorn `_ does, you need to use some sort of interprocess\ncommunication.\n\n``chatrooms.utils.redis_handlers`` module contains the ``RedisMessageHandler`` class,\nwhich can be set as ``settings.CHATROOMS_MESSAGE_HANDLERS`` to use the application\nin a gunicorn-like environment.\nThe module needs a `redis `_ instance installed and running to work.\n\nAlso a ``chatrooms.utils.celery_handlers.CeleryMessageHandler`` class has been included.\nIt can be used as ``settings.CHATROOMS_MESSAGE_HANDLERS`` as well, but needs `celery `_ to be installed.\n\nSee the `Message Handlers`_ section to know how to implement your own handlers.\n\n\nUsing the app\n*************\n\nModels\n------\nThe app installs two models: Room and Message.\nRooms can be created by Admin Site.\nRoom objects have the following fields:\n\n:name:\n:description: almost self-explaining\n:slug: which identifies the room in urls and views\n:subscribers: which references a set of users (not used by default)\n:allow_anonymous_access: which tells whether the room is accessible only to logged users, or event to \"guests\". A guest user is asked to choose a guest name before entering the room.\n:private:\n:password: These fields aren't used by default. They might be useful for implementing custom policies of access. See the `Custom access policies`_ section for further details.\n\n\nViews\n-----\nBesides the core views that handle ajax requests to make the chat work, some class-based views have been designed.\n\nThese are in ``views.py``:\n\n- ``RoomsListView``, which shows the list of rooms filtering the ones requiring a logged user if the user is not authenticated\n- ``RoomView``, which renders the actual room page\n- ``GuestNameView``, which is shown to non-logged users entering an ``allow_anonymous_access`` room to choose a guest name\n\n\nTemplates\n---------\nThe templates you might want to override are\n\n- ``chatrooms/guestname_form.html``, which is rendered by GuestNameView: it shows the form for choosing a guest name\n- ``chatrooms/rooms_list.html``, which is rendered by RoomsListView\n- ``chatrooms/room.html``, which is the skeleton of the page where chat objects are placed dynamically. The page includes the ``js/room.js`` script which requires a ``getContext()`` function like::\n\n \n\n\nSome elements are required by ``room.js`` and need to be included in ``room.html``:\n\n| ``#chatText``: an empty ``div``,\n| ``#chatSendText``: text input where the user enters the text to send,\n| ``#chatSendButton``: button input pressed by user to submit text,\n| ``#connectedUsersList``: a list element where connected users are shown.\n\n\nStyles\n------\n``static/css`` folder contains the file ``room.css`` you might want to override to re-style the room page.\n\n\nTests\n-----\nThe ``test_gevent`` command has been implemented to test the chat features that use gevent libraries.\n\n\nMessage Handlers\n****************\n\n``utils.handlers.MessageHandler`` class implements the methods\n\n- ``handle_received_message(sender, room_id, username, message, date, [user])``\n\n :sender: the ChatView instance\n :room_id: the id of the room where the message was sent\n :username: username or guest name of the user who sent the message\n :message: the content of the sent message\n :date: the timestamp of the sent message\n :user: request.user if user is authenticated, else ``None``\n\n- ``retrieve_messages(chatobj, room_id, latest_msg_id)``\n\n :chatobj: the ChatView instance\n :room_id: the id of the room whose messages are requested\n :latest_msg_id: the id of the latest message sent to the room\n\n- ``get_latest_message_id(chatobj, room_id)``\n\n :chatobj: the ChatView instance\n :room_id: the id of the room whose latest message id is requested\n\n``handle_received_message`` method is designed to perform operations\nwith the received message such that ``retrieve_messages`` is able to\nretrieve it afterwards.\n\n``retrieve_messages`` must return a list of tuples like ``[(message_id, message_obj), ...]``, where ``message_obj`` is an instance of ``Message`` or an object with at least the following attributes:\n\n- ``username``\n- ``date``\n- ``content``\n\nand ``message_id`` is a unique progressive identifier.\n\n``get_latest_message_id`` must give back the id of the latest message received,\nconsistently to the ways messages are stored and retrieved.\n\n\nTo implement your handlers you need to create a class extending ``chatrooms.utils.handlers.MessageHandler``, say ``my.app.MyHandlerClass``,\noverride the aforementioned methods, and add to your settings::\n\n CHATROOMS_HANDLERS_CLASS = 'my.app.MyHandlerClass'\n\nThis way your defined methods will be used as default handlers for received messages and requests for messages.\n\n\nSee ``utils.handlers.MessageHandler`` and ``ajax.chat.ChatView`` docstrings for further details on these classes.\n\n\nCustom access policies\n**********************\n\nAccess to rooms can be controlled defining a function which takes ``request`` and ``user`` as arguments, and returns True or False whether the user is allowed to access the room or not (``room_id`` is given as a GET parameter of the request).\n\nOnce you defined your function, say ``my.app.user_can_enter_foo``, add to your settings::\n\n CHATROOMS_TEST_USER_FUNCTION = 'my.app.user_can_enter_foo'\n\nYour function will be used as a test by view decorators.\nWhen the user sends ajax requests to send or get chat messages, or get the connected users list, ``request`` and ``user`` are passed to your function.\nIf it returns ``False``, a 403 Forbidden Resource response is given, else the request is normally processed.\n\n\nAcknowledgements\n****************\n\n`Denis Bilenko \\'s webchat example `_ has been a great starting point for the design of this app.\n\n\nFurther improvements\n********************\n\n- Users list methods could be improved to work properly in multi-process environments, as it's been done with message handlers.",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/qubird/django-chatrooms",
"keywords": "django chat ajax",
"license": "GPL",
"maintainer": null,
"maintainer_email": null,
"name": "django-chatrooms",
"package_url": "https://pypi.org/project/django-chatrooms/",
"platform": "UNKNOWN",
"project_url": "https://pypi.org/project/django-chatrooms/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "https://github.com/qubird/django-chatrooms"
},
"release_url": "https://pypi.org/project/django-chatrooms/1.2adev/",
"requires_dist": null,
"requires_python": null,
"summary": "A django app providing reverse-ajax chat rooms",
"version": "1.2adev"
},
"last_serial": 789278,
"releases": {
"1.0adev": [
{
"comment_text": "",
"digests": {
"md5": "49c81100551d5de7260152140eb71b53",
"sha256": "880d0be6542d87e59bc785117acc4bbff961b33199d7105bee6c630ea9bb9253"
},
"downloads": -1,
"filename": "django-chatrooms-1.0adev.tar.gz",
"has_sig": false,
"md5_digest": "49c81100551d5de7260152140eb71b53",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11457,
"upload_time": "2011-12-15T17:17:13",
"url": "https://files.pythonhosted.org/packages/91/db/6559c65ac17208c305a4f0fcaf8cb164c50b5ec4fcc0c56f6720cf0c3b34/django-chatrooms-1.0adev.tar.gz"
}
],
"1.1adev": [
{
"comment_text": "",
"digests": {
"md5": "594f9d45478e182038d71cbc297172d9",
"sha256": "3c20b9d16220e1da591049c8c39f5f2c4b2814547ffe50744ddbaa615d3bceca"
},
"downloads": -1,
"filename": "django-chatrooms-1.1adev.tar.gz",
"has_sig": false,
"md5_digest": "594f9d45478e182038d71cbc297172d9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16551,
"upload_time": "2011-12-20T01:48:36",
"url": "https://files.pythonhosted.org/packages/37/09/dbb18d8d7777013c83a7c8b584df3c6df3ed68f5fa0035b20ddab1a22834/django-chatrooms-1.1adev.tar.gz"
}
],
"1.2adev": [
{
"comment_text": "",
"digests": {
"md5": "edbf544820a29f9ed5845ff7617fb5fb",
"sha256": "5f0a0bdf9b83adbf93f197d8c7b685c47c75ae1c603f4c6fdaea72972256f54e"
},
"downloads": -1,
"filename": "django-chatrooms-1.2adev.tar.gz",
"has_sig": false,
"md5_digest": "edbf544820a29f9ed5845ff7617fb5fb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 18025,
"upload_time": "2011-12-27T22:10:38",
"url": "https://files.pythonhosted.org/packages/43/2c/ed8cd28e5340fc1e0c6895b3a21431ee01649bd23fecba72d55e35f0fc11/django-chatrooms-1.2adev.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "edbf544820a29f9ed5845ff7617fb5fb",
"sha256": "5f0a0bdf9b83adbf93f197d8c7b685c47c75ae1c603f4c6fdaea72972256f54e"
},
"downloads": -1,
"filename": "django-chatrooms-1.2adev.tar.gz",
"has_sig": false,
"md5_digest": "edbf544820a29f9ed5845ff7617fb5fb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 18025,
"upload_time": "2011-12-27T22:10:38",
"url": "https://files.pythonhosted.org/packages/43/2c/ed8cd28e5340fc1e0c6895b3a21431ee01649bd23fecba72d55e35f0fc11/django-chatrooms-1.2adev.tar.gz"
}
]
}