A flexible Chat Application for open source software society.
Project description
Django Chat App
A flexible Chat Application for open source software society.
Table of Contents
Screenshots
Client:
Supporter panel:
Features
- Supporter panel
- Play Tic-Toc-Toe game in client side
- Report the client
- Write your ready messages and use them in Supporter panel
- Editable, Deletable messages and show or hide deleted message in supporter panel or client side
- Emoji bar
- Reply message
- Rtl and Ltr template
- Show client or supporter status (online | last seen recently)
- Double check for send and seen message
- Easily customize settings
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
andchannels
to your INSTALLED_APPS.
INSTALLED_APPS = [
...
'daphne',
'channels',
]
- 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 for channel layer settings:
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels.layers.InMemoryChannelLayer"
}
}
- For run the server, just enough run this command:
python3 manage.py runserver
Now, You have a Async Project. ASGI applications support synchronous and asynchronous tasks.
Quick start
- Install django-chatapp in your project:
pip install django-chatapp
- Add "chatapp" to your INSTALLED_APPS in settings.py
INSTALLED_APPS = [
...
'chatapp',
]
- Include the chatapp URLconf in your project urls.py like this:
from chatapp.views import supporter_homepage
path('django-chatapp/chat/supporter/', supporter_homepage),
path('', include('chatapp.urls', namespace='chatapp')),
- Run
python3 manage.py migrate
to create the chatapp models. - Now, You can include chatapp section to your main template:
{% load chatapp %}
{% include_chatapp %}
Customize Settings
- Set direction of your template. Right to left, Left to right or Auto. If you set
auto
, you must have translation system in your project and your urls start with /en/ or /fa/ or /ar/ or /ru/.
CHATAPP_DIR = 'ltr' # other value: rtl - ltr - auto
- Set chat application language. If you don't use translation system, you can set this value. If you set
auto
, you must have translation system in your project and your urls start with /en/ or /fa/ or /ar/ or /ru/.
CHATAPP_LANGUAGE = 'en' # other value: auto - en - fa - ar - ru
- Set login url for supporter panel. If Supporter was not login, redirects to this url. as default, shows
<h3>Login Required.</h3>
to supporter.
CHATAPP_SUPPORTER_LOGIN_URL = '<your_url>'
- 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 Hide 'This message has been deleted.':
CHATAPP_SHOW_DELETED_MESSAGE = True
- Enable game for Client:
CHATAPP_GAME = True
- Fields for client login is firstname, lastname and (phone? or email?)
CHATAPP_AUTHFIELDS = 'email' # other value: phone OR email
- Title and SubTitle of chat box header:
CHATAPP_TITLE = 'title'
CHATAPP_SUBTITLE = 'please await.'
- Maximoum report for a Client:
CHATAPP_MAX_REPORT_NUMBER = 2
- The number of messages that are loaded at the first time:
CHATAPP_MESSAGES_COUNT = 30
Contributing
We welcome contributions to our project! To contribute, please follow these steps:
- Fork this repository to your own account
- Clone your forked repository to your local machine
- Create a new branch for your changes
- Make your changes and commit them with a descriptive commit message
- Push your changes to your forked repository
- Submit a pull request :D
Please ensure that your code is well-tested and follows our code style guidelines. We also welcome bug reports, feature requests, and feedback on the project. Thank you for contributing to our project!
History
- Version 1.4 (2023-Mar-23) - First stable release
License
MIT License
Copyright (c) 2023 django-chatapp
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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.4.tar.gz
.
File metadata
- Download URL: django-chatapp-1.4.tar.gz
- Upload date:
- Size: 274.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cb09e338e1ea39146e682e3dcc250d2010714c5b7263afce5b11f893d50d4c2 |
|
MD5 | 73c93b5d9b4438959c6760b44f0d1732 |
|
BLAKE2b-256 | 279b751c24f22f4b9c666c345eab4a65c7535c36ac4840391ba3ad1735482802 |
File details
Details for the file django_chatapp-1.4-py3-none-any.whl
.
File metadata
- Download URL: django_chatapp-1.4-py3-none-any.whl
- Upload date:
- Size: 280.0 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 | 082c30b2a6004a613755432d26acd31c4027232f33142410aa0802f9dbd67a88 |
|
MD5 | 82d60c5aae89b37c9e267f00ce017dfc |
|
BLAKE2b-256 | 45266f14181f4e867af9f9836866c6e50ed0cef8e3eb227d9bba1fcb8ebbb184 |