Skip to content

synw/django-rechat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Rechat

Chat application for Django using websockets

Install

pip install django-rechat

Add "rechat" and "instant" to INSTALLED_APPS in settings and update urls.py:

urlpatterns = [
    # ...
    path("instant/", include("instant.urls")),
    path("rechat/", include("rechat.urls")),
]

Install the websockets server: quickstart

Create chat rooms in the admin

Usage

An Alpinejs frontend is available. To use the rechat templates create your own index template (here with Tailwind css classes):

{% extends "base.html" %}

{% block content %}
{% include "rechat/init.html" %}
<div class="flex flex-row h-full" x-init="$rechat.hxget('{% url 'rechat-rooms' %}', '#rooms')">
  <div id="rooms" class="w-2/12 h-full p-3 border-r border-gray-200 bg-slate-100">
    Loading rooms ..
  </div>
  <div id="room">
    <div class="p-5 text-stone-400">Select a chatroom</div>
  </div>
</div>
{% endblock %}

Example project

A runnable example project is available

Todo

  • Add a persistence layer option
  • Group level authorizations and rooms
  • Rate limits
  • Channel admin, kick/ban
  • Add a presence widget to show users in the chat