Skip to main content

A pluggable real-time chat app for Django (Channels) with multi-file uploads and light/dark UI.

Project description

django-chatkit

A plug-and-play Django app that provides real-time chat (via Channels), multi-file attachments, Telegram/WhatsApp-inspired UI with light/dark mode, and simple per-user settings.

Features

  • Real-time message streaming (WebSocket) using Django Channels
  • Send text plus multiple file attachments per message
  • Room-based chats (1:1 or group)
  • Clean, responsive UI; light/dark theme toggle and user preference storage
  • Drop-in Django app with URLs, templates, static assets
  • Minimal dependencies

Quickstart (dev)

  1. Install:
pip install -e .
  1. Add to INSTALLED_APPS:
INSTALLED_APPS = [
    ...,
    "django.contrib.staticfiles",
    "channels",
    "chatkit",
]
  1. Channels / ASGI (project asgi.py):
import os
from django.core.asgi import get_asgi_application
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
import chatkit.routing

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "yourproject.settings")

django_asgi_app = get_asgi_application()

application = ProtocolTypeRouter({
    "http": django_asgi_app,
    "websocket": AuthMiddlewareStack(
        URLRouter(chatkit.routing.websocket_urlpatterns)
    ),
})
  1. Channels layer (settings.py). For dev you can leave default in-memory layer. For production, use Redis:
CHANNEL_LAYERS = {
    "default": {
        "BACKEND": "channels_redis.core.RedisChannelLayer",
        "CONFIG": {"hosts": [("127.0.0.1", 6379)]},
    }
}
  1. URLs (project urls.py):
from django.urls import path, include

urlpatterns = [
    path("chat/", include("chatkit.urls", namespace="chatkit")),
]
  1. Media (for attachments) in settings.py:
MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_DIR / "media"
  1. Templates: ensure app templates are discovered:
TEMPLATES = [{
  "BACKEND": "django.template.backends.django.DjangoTemplates",
  "DIRS": [],
  "APP_DIRS": True,
  "OPTIONS": {"context_processors": [
      "django.template.context_processors.debug",
      "django.template.context_processors.request",
      "django.contrib.auth.context_processors.auth",
      "django.contrib.messages.context_processors.messages",
  ]},
}]
  1. Run migrations:
python manage.py migrate
  1. Create a superuser (optional):
python manage.py createsuperuser
  1. Start dev server (with daphne or runserver):
python manage.py runserver
# or
daphne yourproject.asgi:application
  1. Open: http://localhost:8000/chat/

Notes

  • This package is intentionally minimal but production-ready with Channels.
  • For group chats, add multiple users to a room via the admin.
  • The HTTP endpoint is used to submit messages + files. WebSocket broadcasts updates to connected clients in that room.

License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_chatkit-0.1.0.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_chatkit-0.1.0-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file django_chatkit-0.1.0.tar.gz.

File metadata

  • Download URL: django_chatkit-0.1.0.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for django_chatkit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1116dc063411d9115638a3e84e55e462f24d3766239867cbb8a6c481a0a64c67
MD5 b66235cb0e6eaa658fe92cff7d88ed56
BLAKE2b-256 ccfb8e82c3077c9204b7c998ee95d828ca20f80cfe7e0d23a3957ff49de107e6

See more details on using hashes here.

File details

Details for the file django_chatkit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: django_chatkit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for django_chatkit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a59439004a3d4fd172eca78fb83cf8a18ce9daf4c22a473e5d6e42684cd84e30
MD5 210a38c7456cda7bf217595047549b7e
BLAKE2b-256 a25116e876d154c3db131f8d187adeebdcafb6ac23e553c963ad4255eb2c36dc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page