Skip to main content

Conversate - Persistent chat for Django

A simple lightweight persistent chat app for Django sites, where users may not always be around at the same time.

Requiring nothing other than a working Django installation, messages can be left for users to pick up later, users can opt in to receive e-mail alerts of activity when they are away, and real-time conversations are supported through simple polling so it will work through the most restrictive of firewalls.

Features

  • Admins create rooms and add users to them

  • Messages are stored in the database

  • Full history is available to all users of that room

  • File upload support

  • Simple jquery-based polling for real-time updates

  • Users can opt in to receive e-mail alerts of activity when away

  • Support for users without javascript

Supports Django 2.2+, on Python 3.6+.

  • See CHANGES for full changelog and roadmap

  • See UPGRADE for how to upgrade from earlier releases

Please note: this is designed for small groups to have infrequent conversations which are often asynchronous; because each poll event will create a new HTTP connection, installations where a large number of concurrent users are expected should look for a different solution involving long-polling and websockets.

There is an example site in the example directory.

Installation

  1. Install django-conversate (currently only on github):

    pip install -e git+https://github.com/radiac/django-conversate.git#egg=django-conversate

    Note: The master branch may sometimes contain minor changes made since the version was incremented. These changes will be listed in CHANGES. It will always be safe to use, but versions will be tagged if you only want to follow releases.

  2. Add Conversate to INSTALLED_APPS:

    INSTALLED_APPS = (
        ...
        'conversate',
    )

    You may also want to change some settings here (see Settings below)

  3. Include the URLconf in your project’s urls.py:

    url(r'^conversate/', include('conversate.urls', namespace='conversate')),
  4. Make sure your base.html template has the necessary blocks, or override Conversate’s base, conversate/base.html (see Templates and styles below). You will also want to create a link somewhere to conversate-index (or conversate.views.index) so users can access it.

  5. Add the models to the database:

    python manage.py migrate conversate

Settings

Add these settings to your settings.py file to override the defaults.

CONVERSATE_PAGE_SIZE

Number of lines to show on a page

Default: 100

CONVERSATE_IDLE_AT:

The time until the UI decides that the user is idle (in ms)

Default: 60*1000

CONVERSATE_POLL_MIN:

Minimum poll interval (in ms)

Default: 5 * 1000

CONVERSATE_POLL_MAX:

Maximum poll interval (in ms)

Default: 60 * 1000

CONVERSATE_POLL_STEP:

Amount to increase poll interval by when there is no activity (in ms)

Default: 5 * 1000

CONVERSATE_CONTROL_LAYOUT:

If True, Conversate’s JavaScript will control the layout: * changes the container element to position:relative and padding:0 * maximises container element’s height into available space in the window * makes the conversation scroll in place * moves the input field to the bottom of the container

Default: True

CONVERSATE_DISCONNECT_AT:

How long before marking the user as disconnected (in secs)

Defaults to POLL_MAX plus 30 seconds, 60 + 30

CONVERSATE_EMAIL_FROM:

From address for alert e-mails

Default: DEFAULT_FROM_EMAIL (from main Django settings)

CONVERSATE_STORE_ROOT:

Path to dir where uploaded files are stored.

This should not be publicly accessible otherwise files could be downloaded without permission. The default value is the media root so that it works out of the box, but this is insecure as permission checks can be bypassed.

Example: os.path.join(BASE_DIR, "..", "private")

Default: MEDIA_ROOT

Templates and styles

The Conversate templates extend conversate/base.html, which in turn extends base.html. The templates use HTML5 elements.

They will expect the following blocks:

  • js for inserting JavaScript

  • css for inserting CSS

  • title for inserting the title (plain text) - or {{ title }} instead

  • content for the body content

You will need to add these to your base.html template. Alternatively, if you already have the blocks but with different names, create conversate/base.html in your own templates folder and map them; for example:

{% block script %}
    {{ block.super }}
    {% block js %}{% endblock %}
{% endblock %}

Once you have mapped these blocks, the default settings and templates should work out of the box with most designs. However, the conversate container element in your site’s base template should be given a fixed height and width to contain the chat interface.

There is a single global JavaScript variable used, CONVERSATE, which the template uses to pass settings and variables to the JavaScript.

Usage

Set up one or more rooms in the Django admin site, and the rooms will be listed for your users on the conversate index page.

Users can double-click the poll timer to force a faster poll.

Credits

Thanks to all contributors, who are listed in CHANGES.

This project includes bundled JavaScript dependencies.

Metadata

Release files for django-conversate 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-conversate 0.3.0
File Size Uploaded Provenance Actions
django-conversate-0.3.0.tar.gz 60.8 kB Without provenance Details for django-conversate-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-conversate 0.3.0
File Interpreter ABI Platform Actions
django_conversate-0.3.0-py3-none-any.whl Python 3 none any Details for django_conversate-0.3.0-py3-none-any.whl

Total release size: 121.1 kB

Release files / django-conversate-0.3.0.tar.gz

Download URL django-conversate-0.3.0.tar.gz
Size 60.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f2eb89659ec9101b6c508969b6b419226b814322821fcab7de9d77739398d5f7
BLAKE2b-256 checksum
How to use checksums
5b6b040d18322c060bc5a0beb5359fb2758b722d3278be8e6da4a0123aa9c8be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.0

Release files / django_conversate-0.3.0-py3-none-any.whl

Download URL django_conversate-0.3.0-py3-none-any.whl
Size 60.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5e800ea71e0d61c57d0d0da1ad9f93ca1c5d1911f6211c7ae0b5d93175ceb77
BLAKE2b-256 checksum
How to use checksums
fd0b8fe3cba36eb7528c7f12059990418e517cdba7cde886c73d578c26d3ea77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.0

Security for django-conversate 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page