[![PyPi Version](https://img.shields.io/pypi/v/django-chatapp.svg)](https://pypi.org/project/django-chatapp/1.4/)
[![GitHub stars](https://img.shields.io/github/stars/saeedrezaghazanfari/django-chat-app.svg?style=social)](https://github.com/saeedrezaghazanfari/django-chat-app)
<br><br>
![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54)
![Django](https://img.shields.io/badge/django-%23092E20.svg?style=for-the-badge&logo=django&logoColor=white)
![Vue.js](https://img.shields.io/badge/vuejs-%2335495e.svg?style=for-the-badge&logo=vuedotjs&logoColor=%234FC08D)
![SASS](https://img.shields.io/badge/SASS-hotpink.svg?style=for-the-badge&logo=SASS&logoColor=white)
# Django Chat App
A flexible Chat Application for open source software society.
## Table of Contents
- [Screenshots](https://github.com/saeedrezaghazanfari/django-chat-app#screenshots)
- [Features](https://github.com/saeedrezaghazanfari/django-chat-app#features)
- [Prerequisites](https://github.com/saeedrezaghazanfari/django-chat-app#prerequisites)
- [Quick Start](https://github.com/saeedrezaghazanfari/django-chat-app#quick-start)
- [Customize Settings](https://github.com/saeedrezaghazanfari/django-chat-app#customize-settings)
- [Contributing](https://github.com/saeedrezaghazanfari/django-chat-app#contributing)
- [History](https://github.com/saeedrezaghazanfari/django-chat-app#history)
- [License](https://github.com/saeedrezaghazanfari/django-chat-app#license)
## Screenshots
#### Client:
![client chat view](https://github.com/saeedrezaghazanfari/my_css_layouts/blob/main/shared/djangochatapp-client-1.4.png)
#### Supporter panel:
![supporter panel view](https://github.com/saeedrezaghazanfari/my_css_layouts/blob/main/shared/djangochatapp-supporter-1.4.png)
## 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.
1. Install channels and daphne packages:
```
pip install channels==4.0.0 daphne==4.0.0
```
2. Then, In asgi.py file:
```python
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)
)
)
})
```
3. And in settings.py, add `daphne` and `channels` to your INSTALLED_APPS.
```python
INSTALLED_APPS = [
...
'daphne',
'channels',
]
```
4. Then, You must edit this line:
```python
WSGI_APPLICATION = '<your_app_name>.wsgi.application'
```
to this line:
```python
ASGI_APPLICATION = '<your_app_name>.asgi.application'
```
5. And for last item, Add these codes for channel layer settings:
```python
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels.layers.InMemoryChannelLayer"
}
}
```
6. 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
1. Install django-chatapp in your project:
```
pip install django-chatapp
```
2. Add "chatapp" to your INSTALLED_APPS in settings.py
```python
INSTALLED_APPS = [
...
'chatapp',
]
```
3. Include the chatapp URLconf in your project urls.py like this:
```python
from chatapp.views import supporter_homepage
path('django-chatapp/chat/supporter/', supporter_homepage),
path('', include('chatapp.urls', namespace='chatapp')),
```
4. Run `python3 manage.py migrate` to create the chatapp models.
5. 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/.
```python
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/.
```python
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.
```python
CHATAPP_SUPPORTER_LOGIN_URL = '<your_url>'
```
- Editable message via Client:
```python
CHATAPP_EDIT_USER_MESSAGE = True
```
- Deleteable message via Client:
```python
CHATAPP_DELETE_USER_MESSAGE = True
```
- Editable message via Supporter:
```python
CHATAPP_EDIT_SUPPORTER_MESSAGE = True
```
- Deleteable message via Supporter:
```python
CHATAPP_DELETE_SUPPORTER_MESSAGE = True
```
- Show or Hide 'This message has been deleted.':
```python
CHATAPP_SHOW_DELETED_MESSAGE = True
```
- Enable game for Client:
```python
CHATAPP_GAME = True
```
- Fields for client login is firstname, lastname and (phone? or email?)
```python
CHATAPP_AUTHFIELDS = 'email' # other value: phone OR email
```
- Title and SubTitle of chat box header:
```python
CHATAPP_TITLE = 'title'
CHATAPP_SUBTITLE = 'please await.'
```
- Maximoum report for a Client:
```python
CHATAPP_MAX_REPORT_NUMBER = 2
```
- The number of messages that are loaded at the first time:
```python
CHATAPP_MESSAGES_COUNT = 30
```
## Contributing
We welcome contributions to our project! To contribute, please follow these steps:
1. Fork this repository to your own account
2. Clone your forked repository to your local machine
3. Create a new branch for your changes
4. Make your changes and commit them with a descriptive commit message
5. Push your changes to your forked repository
6. 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/saeedrezaghazanfari/django-chat-app",
"name": "django-chatapp",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": "",
"keywords": "django chat websocket channels asgi vuejs",
"author": "SaeedReza Ghazanfari",
"author_email": "saeedreza.gh.1397@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/27/9b/751c24f22f4b9c666c345eab4a65c7535c36ac4840391ba3ad1735482802/django-chatapp-1.4.tar.gz",
"platform": "any",
"description": "[![PyPi Version](https://img.shields.io/pypi/v/django-chatapp.svg)](https://pypi.org/project/django-chatapp/1.4/)\n[![GitHub stars](https://img.shields.io/github/stars/saeedrezaghazanfari/django-chat-app.svg?style=social)](https://github.com/saeedrezaghazanfari/django-chat-app)\n<br><br>\n![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54)\n![Django](https://img.shields.io/badge/django-%23092E20.svg?style=for-the-badge&logo=django&logoColor=white)\n![Vue.js](https://img.shields.io/badge/vuejs-%2335495e.svg?style=for-the-badge&logo=vuedotjs&logoColor=%234FC08D)\n![SASS](https://img.shields.io/badge/SASS-hotpink.svg?style=for-the-badge&logo=SASS&logoColor=white)\n# Django Chat App\nA flexible Chat Application for open source software society.\n\n## Table of Contents\n- [Screenshots](https://github.com/saeedrezaghazanfari/django-chat-app#screenshots)\n- [Features](https://github.com/saeedrezaghazanfari/django-chat-app#features)\n- [Prerequisites](https://github.com/saeedrezaghazanfari/django-chat-app#prerequisites)\n- [Quick Start](https://github.com/saeedrezaghazanfari/django-chat-app#quick-start)\n- [Customize Settings](https://github.com/saeedrezaghazanfari/django-chat-app#customize-settings)\n- [Contributing](https://github.com/saeedrezaghazanfari/django-chat-app#contributing)\n- [History](https://github.com/saeedrezaghazanfari/django-chat-app#history)\n- [License](https://github.com/saeedrezaghazanfari/django-chat-app#license)\n\n## Screenshots\n#### Client:\n![client chat view](https://github.com/saeedrezaghazanfari/my_css_layouts/blob/main/shared/djangochatapp-client-1.4.png)\n\n#### Supporter panel:\n![supporter panel view](https://github.com/saeedrezaghazanfari/my_css_layouts/blob/main/shared/djangochatapp-supporter-1.4.png)\n\n## Features\n- Supporter panel\n- Play Tic-Toc-Toe game in client side\n- Report the client\n- Write your ready messages and use them in Supporter panel\n- Editable, Deletable messages and show or hide deleted message in supporter panel or client side\n- Emoji bar\n- Reply message\n- Rtl and Ltr template\n- Show client or supporter status (online | last seen recently)\n- Double check for send and seen message\n- Easily customize settings\n## Prerequisites\nYour project must use ASGI engine. You can use from `channels` and `daphne`.\nfor convert WSGI to ASGI, you can follow these commands.\n1. Install channels and daphne packages:\n```\npip install channels==4.0.0 daphne==4.0.0\n```\n2. Then, In asgi.py file:\n```python\nimport os\nfrom django.core.asgi import get_asgi_application\nfrom channels.routing import ProtocolTypeRouter, URLRouter\nfrom channels.auth import AuthMiddlewareStack\nfrom channels.sessions import SessionMiddlewareStack\nfrom chatapp.routing import ws_urlpatterns\n\n\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'App_Config.settings')\n\napplication = ProtocolTypeRouter({\n 'http': get_asgi_application(),\n 'websocket': SessionMiddlewareStack(\n AuthMiddlewareStack(\n URLRouter(ws_urlpatterns)\n )\n )\n})\n```\n3. And in settings.py, add `daphne` and `channels` to your INSTALLED_APPS.\n```python\nINSTALLED_APPS = [\n ...\n 'daphne',\n 'channels',\n]\n```\n4. Then, You must edit this line:\n```python\nWSGI_APPLICATION = '<your_app_name>.wsgi.application'\n```\nto this line:\n```python\nASGI_APPLICATION = '<your_app_name>.asgi.application'\n```\n5. And for last item, Add these codes for channel layer settings:\n```python\nCHANNEL_LAYERS = {\n \"default\": {\n \"BACKEND\": \"channels.layers.InMemoryChannelLayer\"\n }\n}\n```\n6. For run the server, just enough run this command:\n```\npython3 manage.py runserver\n```\nNow, You have a Async Project. ASGI applications support synchronous and asynchronous tasks.\n\n\n\n## Quick start\n1. Install django-chatapp in your project:\n```\npip install django-chatapp\n```\n2. Add \"chatapp\" to your INSTALLED_APPS in settings.py\n```python\nINSTALLED_APPS = [\n ...\n 'chatapp',\n]\n```\n3. Include the chatapp URLconf in your project urls.py like this:\n```python\nfrom chatapp.views import supporter_homepage\n\npath('django-chatapp/chat/supporter/', supporter_homepage),\npath('', include('chatapp.urls', namespace='chatapp')),\n```\n4. Run `python3 manage.py migrate` to create the chatapp models.\n5. Now, You can include chatapp section to your main template:\n```\n{% load chatapp %}\n\n{% include_chatapp %}\n```\n\n\n## Customize Settings\n\n- 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/. \n```python\nCHATAPP_DIR = 'ltr' # other value: rtl - ltr - auto\n```\n\n- 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/. \n```python\nCHATAPP_LANGUAGE = 'en' # other value: auto - en - fa - ar - ru\n```\n\n- Set login url for supporter panel. If Supporter was not login, redirects to this url. as default, shows `<h3>Login Required.</h3>` to supporter. \n```python\nCHATAPP_SUPPORTER_LOGIN_URL = '<your_url>'\n```\n\n- Editable message via Client:\n```python\nCHATAPP_EDIT_USER_MESSAGE = True\n```\n\n- Deleteable message via Client:\n```python\nCHATAPP_DELETE_USER_MESSAGE = True\n```\n\n- Editable message via Supporter:\n```python\nCHATAPP_EDIT_SUPPORTER_MESSAGE = True\n```\n\n- Deleteable message via Supporter:\n```python\nCHATAPP_DELETE_SUPPORTER_MESSAGE = True\n```\n\n- Show or Hide 'This message has been deleted.':\n```python\nCHATAPP_SHOW_DELETED_MESSAGE = True\n```\n\n- Enable game for Client:\n```python\nCHATAPP_GAME = True\n```\n\n- Fields for client login is firstname, lastname and (phone? or email?)\n```python\nCHATAPP_AUTHFIELDS = 'email' # other value: phone OR email\n```\n\n- Title and SubTitle of chat box header:\n```python\nCHATAPP_TITLE = 'title'\nCHATAPP_SUBTITLE = 'please await.'\n```\n\n- Maximoum report for a Client:\n```python\nCHATAPP_MAX_REPORT_NUMBER = 2\n```\n\n- The number of messages that are loaded at the first time:\n```python\nCHATAPP_MESSAGES_COUNT = 30\n```\n\n## Contributing\nWe welcome contributions to our project! To contribute, please follow these steps:\n\n1. Fork this repository to your own account\n2. Clone your forked repository to your local machine\n3. Create a new branch for your changes\n4. Make your changes and commit them with a descriptive commit message\n5. Push your changes to your forked repository\n6. Submit a pull request :D\n\nPlease 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.\nThank you for contributing to our project!\n\n## History\n- Version 1.4 (2023-Mar-23) - First stable release\n\n## License\nMIT License\n\nCopyright (c) 2023 django-chatapp\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A flexible Chat Application for open source software society.",
"version": "1.4",
"split_keywords": [
"django",
"chat",
"websocket",
"channels",
"asgi",
"vuejs"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "45266f14181f4e867af9f9836866c6e50ed0cef8e3eb227d9bba1fcb8ebbb184",
"md5": "82d60c5aae89b37c9e267f00ce017dfc",
"sha256": "082c30b2a6004a613755432d26acd31c4027232f33142410aa0802f9dbd67a88"
},
"downloads": -1,
"filename": "django_chatapp-1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "82d60c5aae89b37c9e267f00ce017dfc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3",
"size": 279963,
"upload_time": "2023-04-06T08:12:45",
"upload_time_iso_8601": "2023-04-06T08:12:45.327994Z",
"url": "https://files.pythonhosted.org/packages/45/26/6f14181f4e867af9f9836866c6e50ed0cef8e3eb227d9bba1fcb8ebbb184/django_chatapp-1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "279b751c24f22f4b9c666c345eab4a65c7535c36ac4840391ba3ad1735482802",
"md5": "73c93b5d9b4438959c6760b44f0d1732",
"sha256": "3cb09e338e1ea39146e682e3dcc250d2010714c5b7263afce5b11f893d50d4c2"
},
"downloads": -1,
"filename": "django-chatapp-1.4.tar.gz",
"has_sig": false,
"md5_digest": "73c93b5d9b4438959c6760b44f0d1732",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 274857,
"upload_time": "2023-04-06T08:13:47",
"upload_time_iso_8601": "2023-04-06T08:13:47.535352Z",
"url": "https://files.pythonhosted.org/packages/27/9b/751c24f22f4b9c666c345eab4a65c7535c36ac4840391ba3ad1735482802/django-chatapp-1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-06 08:13:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "saeedrezaghazanfari",
"github_project": "django-chat-app",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "django-chatapp"
}