Skip to main content

A complete chat application in your Django project.

Project description

PyPi Version GitHub stars Python Django Vue.js SASS

Django Chat App

a Free chat application in your website :) if you need a chat application in your django project, you can use from this package. client chat view and supporter panel view.

Some Properties

  1. supporter panel
  2. play game in client side
  3. report the user
  4. write ready messages in supporter panel
  5. customize chat setting like: edit & delete messages and show deleted message
  6. emoji bar
  7. reply message
  8. rtl and ltr template
  9. show status like online or offline
  10. double check for send and seen message

Prerequisites

your project must use ASGI engine. you can use from channels and daphne. for convert WSGI to ASGI, you can follow these commands.

  1. install channels and daphne packages:
pip install channels==4.0.0 daphne==4.0.0
  1. then, in asgi.py file:
import os
from django.core.asgi import get_asgi_application
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
from channels.sessions import SessionMiddlewareStack
from chatapp.routing import ws_urlpatterns


os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'App_Config.settings')

application = ProtocolTypeRouter({
    'http': get_asgi_application(),
    'websocket': SessionMiddlewareStack(
        AuthMiddlewareStack(
            URLRouter(ws_urlpatterns)
        )
    )
})
  1. and in settings.py, add 'daphne', and 'channels', to your INSTALLED_APPS.
  2. then, you must edit this line:
WSGI_APPLICATION = '<your_app_name>.wsgi.application'

to this line:

ASGI_APPLICATION = '<your_app_name>.asgi.application'
  1. and for last item, add these codes:
CHANNEL_LAYERS = {
    "default": {
        "BACKEND": "channels.layers.InMemoryChannelLayer"
    }
}

now, you have a Async Project. ASGI applications support synchronous and asynchronous tasks.

Quick start

  1. Add "chatapp" to your INSTALLED_APPS in settings.py
  2. Include the chatapp URLconf in your project urls.py like this:
from chatapp.views import supporter_homepage

path('django-chat-app/chat/supporter/', supporter_homepage),
path('', include('chatapp.urls')),
  1. Run python manage.py migrate to create the chatapp models.
  2. at now, you can include chatapp section to your main template:
{% load chatapp %}
{% include_chatapp %}

Customize settings

set direction of template

CHATAPP_DIR = 'auto'    # other value: rtl - ltr - auto

editable message via client

CHATAPP_EDIT_USER_MESSAGE = True

deleteable message via client

CHATAPP_DELETE_USER_MESSAGE = True

editable message via supporter

CHATAPP_EDIT_SUPPORTER_MESSAGE = True

deleteable message via supporter

CHATAPP_DELETE_SUPPORTER_MESSAGE = True

show or not show 'this message is deleted'

CHATAPP_SHOW_DELETED_MESSAGE = True

enable game for client

CHATAPP_GAME = True

fields for login is firstname, lastname and (phone or email)

CHATAPP_AUTHFIELDS = 'email'     # phone - email

title and subtitle of chat box header

CHATAPP_TITLE = 'وبسایت تستی'
CHATAPP_SUBTITLE = 'لطفا کوشا باشید.'

maximoum report for users

CHATAPP_MAX_REPORT_NUMBER = 2

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-chatapp-1.1.tar.gz (293.4 kB view hashes)

Uploaded Source

Built Distribution

django_chatapp-1.1-py3-none-any.whl (301.4 kB view hashes)

Uploaded Python 3

Supported by

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