A complete chat application in your Django project.
Project description
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
- supporter panel
- play game in client side
- report the user
- write ready messages in supporter panel
- customize chat setting like: edit & delete messages and show deleted message
- emoji bar
- reply message
- rtl and ltr template
- show status like online or offline
- 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.
- install channels and daphne packages:
pip install channels==4.0.0 daphne==4.0.0
- 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)
)
)
})
- and in settings.py, add
'daphne',
and'channels',
to your INSTALLED_APPS. - then, you must edit this line:
WSGI_APPLICATION = '<your_app_name>.wsgi.application'
to this line:
ASGI_APPLICATION = '<your_app_name>.asgi.application'
- 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
- Add "chatapp" to your INSTALLED_APPS in settings.py
- 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')),
- Run
python manage.py migrate
to create the chatapp models. - 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
Built Distribution
File details
Details for the file django-chatapp-1.2.tar.gz
.
File metadata
- Download URL: django-chatapp-1.2.tar.gz
- Upload date:
- Size: 293.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a33d6c00322c77a3b8fc851daf99d657c2562f0c4e64bf7407f6b997ef9004af |
|
MD5 | 442fb8c2b5daa4d4f35c3231926c6409 |
|
BLAKE2b-256 | 425674923565ea301e37caa95dfe20885d214f2735437311a63c370543382c42 |
File details
Details for the file django_chatapp-1.2-py3-none-any.whl
.
File metadata
- Download URL: django_chatapp-1.2-py3-none-any.whl
- Upload date:
- Size: 301.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2a43b8084170a62f11de3eb8ef669a1d0f0031bdfb0935e063cc4a5d43137b8 |
|
MD5 | dfece2de02d0189f7ff85f1fcc47e4fd |
|
BLAKE2b-256 | 68bcd914c9b87b54f76cde023265d7be8c2f926b7daab34c8b14e9d46c25f160 |