django-chatapp


Namedjango-chatapp JSON
Version 2.1 PyPI version JSON
download
home_pagehttps://github.com/grand-kaveh/django-chat-app
SummaryA flexible Chat Application for open source software society.
upload_time2025-11-01 11:02:14
maintainerNone
docs_urlNone
authorGrand Kaveh
requires_python<=3.12
licenseMIT
keywords django chat websocket channels asgi vuejs
VCS
bugtrack_url
requirements asgiref backports.zoneinfo Django Pillow sqlparse tzdata
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPi Version](https://img.shields.io/pypi/v/django-chatapp.svg)](https://pypi.org/project/django-chatapp/2.1/)

[![GitHub stars](https://img.shields.io/github/stars/grand-kaveh/django-chat-app.svg?style=social)](https://github.com/grand-kaveh/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/grand-kaveh/django-chat-app#screenshots)

- [Features](https://github.com/grand-kaveh/django-chat-app#features)

- [Prerequisites](https://github.com/grand-kaveh/django-chat-app#prerequisites)

- [Quick Start](https://github.com/grand-kaveh/django-chat-app#quick-start)

- [Customize Settings](https://github.com/grand-kaveh/django-chat-app#customize-settings)

- [Contributing](https://github.com/grand-kaveh/django-chat-app#contributing)

- [History](https://github.com/grand-kaveh/django-chat-app#history)

- [License](https://github.com/grand-kaveh/django-chat-app#license)



## Screenshots

#### Client:

![client chat view](https://github.com/grand-kaveh/front-templates/blob/main/shared/djangochatapp-client-1.4.png)



#### Supporter panel:

![supporter panel view](https://github.com/grand-kaveh/front-templates/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. You must include chatapp section to your main template:

```

{% load chatapp %}



{% include_chatapp %}

```

6. Now, Click the blue button in your screen and test your chat application.



## Set Supporter

After installing the package, you need to define a Supporter. <br>

go to Django administration and set a supporter in SupporterModel Table. <br>   

After that, go to your supporter panel at /django-chatapp/chat/supporter/ <br>

Use & Enjoy.



## 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 = 'Welcome'

CHATAPP_SUBTITLE = 'Please wait a moment'

```



- 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 2.0 (2025-Nov-1) - First stable release



## License

MIT License



Copyright (c) 2025 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/grand-kaveh/django-chat-app",
    "name": "django-chatapp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<=3.12",
    "maintainer_email": null,
    "keywords": "django chat websocket channels asgi vuejs",
    "author": "Grand Kaveh",
    "author_email": "great.kaveh.2000@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b4/1e/f852dca5fb8ddad654e698b6916efbbece8b992e4faf1b6e2f895de441b1/django_chatapp-2.1.tar.gz",
    "platform": "any",
    "description": "[![PyPi Version](https://img.shields.io/pypi/v/django-chatapp.svg)](https://pypi.org/project/django-chatapp/2.1/)\r\r\n[![GitHub stars](https://img.shields.io/github/stars/grand-kaveh/django-chat-app.svg?style=social)](https://github.com/grand-kaveh/django-chat-app)\r\r\n<br><br>\r\r\n![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54)\r\r\n![Django](https://img.shields.io/badge/django-%23092E20.svg?style=for-the-badge&logo=django&logoColor=white)\r\r\n![Vue.js](https://img.shields.io/badge/vuejs-%2335495e.svg?style=for-the-badge&logo=vuedotjs&logoColor=%234FC08D)\r\r\n![SASS](https://img.shields.io/badge/SASS-hotpink.svg?style=for-the-badge&logo=SASS&logoColor=white)\r\r\n# Django Chat App\r\r\nA flexible Chat Application for open source software society.\r\r\n\r\r\n## Table of Contents\r\r\n- [Screenshots](https://github.com/grand-kaveh/django-chat-app#screenshots)\r\r\n- [Features](https://github.com/grand-kaveh/django-chat-app#features)\r\r\n- [Prerequisites](https://github.com/grand-kaveh/django-chat-app#prerequisites)\r\r\n- [Quick Start](https://github.com/grand-kaveh/django-chat-app#quick-start)\r\r\n- [Customize Settings](https://github.com/grand-kaveh/django-chat-app#customize-settings)\r\r\n- [Contributing](https://github.com/grand-kaveh/django-chat-app#contributing)\r\r\n- [History](https://github.com/grand-kaveh/django-chat-app#history)\r\r\n- [License](https://github.com/grand-kaveh/django-chat-app#license)\r\r\n\r\r\n## Screenshots\r\r\n#### Client:\r\r\n![client chat view](https://github.com/grand-kaveh/front-templates/blob/main/shared/djangochatapp-client-1.4.png)\r\r\n\r\r\n#### Supporter panel:\r\r\n![supporter panel view](https://github.com/grand-kaveh/front-templates/blob/main/shared/djangochatapp-supporter-1.4.png)\r\r\n\r\r\n## Features\r\r\n- Supporter panel\r\r\n- Play Tic-Toc-Toe game in client side\r\r\n- Report the client\r\r\n- Write your ready messages and use them in Supporter panel\r\r\n- Editable, Deletable messages and show or hide deleted message in supporter panel or client side\r\r\n- Emoji bar\r\r\n- Reply message\r\r\n- Rtl and Ltr template\r\r\n- Show client or supporter status (online | last seen recently)\r\r\n- Double check for send and seen message\r\r\n- Easily customize settings\r\r\n## Prerequisites\r\r\nYour project must use ASGI engine. You can use from `channels` and `daphne`.\r\r\nfor convert WSGI to ASGI, you can follow these commands.\r\r\n1. Install channels and daphne packages:\r\r\n```\r\r\npip install channels==4.0.0 daphne==4.0.0\r\r\n```\r\r\n2. Then, In asgi.py file:\r\r\n```python\r\r\nimport os\r\r\nfrom django.core.asgi import get_asgi_application\r\r\nfrom channels.routing import ProtocolTypeRouter, URLRouter\r\r\nfrom channels.auth import AuthMiddlewareStack\r\r\nfrom channels.sessions import SessionMiddlewareStack\r\r\nfrom chatapp.routing import ws_urlpatterns\r\r\n\r\r\n\r\r\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'App_Config.settings')\r\r\n\r\r\napplication = ProtocolTypeRouter({\r\r\n    'http': get_asgi_application(),\r\r\n    'websocket': SessionMiddlewareStack(\r\r\n        AuthMiddlewareStack(\r\r\n            URLRouter(ws_urlpatterns)\r\r\n        )\r\r\n    )\r\r\n})\r\r\n```\r\r\n3. And in settings.py, add `daphne` and `channels` to your INSTALLED_APPS.\r\r\n```python\r\r\nINSTALLED_APPS = [\r\r\n    ...\r\r\n    'daphne',\r\r\n    'channels',\r\r\n]\r\r\n```\r\r\n4. Then, You must edit this line:\r\r\n```python\r\r\nWSGI_APPLICATION = '<your_app_name>.wsgi.application'\r\r\n```\r\r\nto this line:\r\r\n```python\r\r\nASGI_APPLICATION = '<your_app_name>.asgi.application'\r\r\n```\r\r\n5. And for last item, Add these codes for channel layer settings:\r\r\n```python\r\r\nCHANNEL_LAYERS = {\r\r\n    \"default\": {\r\r\n        \"BACKEND\": \"channels.layers.InMemoryChannelLayer\"\r\r\n    }\r\r\n}\r\r\n```\r\r\n6. For run the server, just enough run this command:\r\r\n```\r\r\npython3 manage.py runserver\r\r\n```\r\r\nNow, You have a Async Project. ASGI applications support synchronous and asynchronous tasks.\r\r\n\r\r\n\r\r\n\r\r\n## Quick start\r\r\n1. Install django-chatapp in your project:\r\r\n```\r\r\npip install django-chatapp\r\r\n```\r\r\n2. Add \"chatapp\" to your INSTALLED_APPS in settings.py\r\r\n```python\r\r\nINSTALLED_APPS = [\r\r\n    ...\r\r\n    'chatapp',\r\r\n]\r\r\n```\r\r\n3. Include the chatapp URLconf in your project urls.py like this:\r\r\n```python\r\r\nfrom chatapp.views import supporter_homepage\r\r\n\r\r\npath('django-chatapp/chat/supporter/', supporter_homepage),\r\r\npath('', include('chatapp.urls', namespace='chatapp')),\r\r\n```\r\r\n4. Run `python3 manage.py migrate` to create the chatapp models.\r\r\n5. You must include chatapp section to your main template:\r\r\n```\r\r\n{% load chatapp %}\r\r\n\r\r\n{% include_chatapp %}\r\r\n```\r\r\n6. Now, Click the blue button in your screen and test your chat application.\r\r\n\r\r\n## Set Supporter\r\r\nAfter installing the package, you need to define a Supporter. <br>\r\r\ngo to Django administration and set a supporter in SupporterModel Table. <br>   \r\r\nAfter that, go to your supporter panel at /django-chatapp/chat/supporter/ <br>\r\r\nUse & Enjoy.\r\r\n\r\r\n## Customize Settings\r\r\n\r\r\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/. \r\r\n```python\r\r\nCHATAPP_DIR = 'ltr'    # other value: rtl - ltr - auto\r\r\n```\r\r\n\r\r\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/. \r\r\n```python\r\r\nCHATAPP_LANGUAGE = 'en'    # other value: auto - en - fa - ar - ru\r\r\n```\r\r\n\r\r\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. \r\r\n```python\r\r\nCHATAPP_SUPPORTER_LOGIN_URL = '<your_url>'\r\r\n```\r\r\n\r\r\n- Editable message via Client:\r\r\n```python\r\r\nCHATAPP_EDIT_USER_MESSAGE = True\r\r\n```\r\r\n\r\r\n- Deleteable message via Client:\r\r\n```python\r\r\nCHATAPP_DELETE_USER_MESSAGE = True\r\r\n```\r\r\n\r\r\n- Editable message via Supporter:\r\r\n```python\r\r\nCHATAPP_EDIT_SUPPORTER_MESSAGE = True\r\r\n```\r\r\n\r\r\n- Deleteable message via Supporter:\r\r\n```python\r\r\nCHATAPP_DELETE_SUPPORTER_MESSAGE = True\r\r\n```\r\r\n\r\r\n- Show or Hide 'This message has been deleted.':\r\r\n```python\r\r\nCHATAPP_SHOW_DELETED_MESSAGE = True\r\r\n```\r\r\n\r\r\n- Enable game for Client:\r\r\n```python\r\r\nCHATAPP_GAME = True\r\r\n```\r\r\n\r\r\n- Fields for client login is firstname, lastname and (phone? or email?)\r\r\n```python\r\r\nCHATAPP_AUTHFIELDS = 'email'     # other value: phone OR email\r\r\n```\r\r\n\r\r\n- Title and SubTitle of chat box header:\r\r\n```python\r\r\nCHATAPP_TITLE = 'Welcome'\r\r\nCHATAPP_SUBTITLE = 'Please wait a moment'\r\r\n```\r\r\n\r\r\n- Maximoum report for a Client:\r\r\n```python\r\r\nCHATAPP_MAX_REPORT_NUMBER = 2\r\r\n```\r\r\n\r\r\n- The number of messages that are loaded at the first time:\r\r\n```python\r\r\nCHATAPP_MESSAGES_COUNT = 30\r\r\n```\r\r\n\r\r\n## Contributing\r\r\nWe welcome contributions to our project! To contribute, please follow these steps:\r\r\n\r\r\n1. Fork this repository to your own account\r\r\n2. Clone your forked repository to your local machine\r\r\n3. Create a new branch for your changes\r\r\n4. Make your changes and commit them with a descriptive commit message\r\r\n5. Push your changes to your forked repository\r\r\n6. Submit a pull request :D\r\r\n\r\r\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.\r\r\nThank you for contributing to our project!\r\r\n\r\r\n## History\r\r\n- Version 2.0 (2025-Nov-1) - First stable release\r\r\n\r\r\n## License\r\r\nMIT License\r\r\n\r\r\nCopyright (c) 2025 django-chatapp\r\r\n\r\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\r\nof this software and associated documentation files (the \"Software\"), to deal\r\r\nin the Software without restriction, including without limitation the rights\r\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\r\ncopies of the Software, and to permit persons to whom the Software is\r\r\nfurnished to do so, subject to the following conditions:\r\r\n\r\r\nThe above copyright notice and this permission notice shall be included in all\r\r\ncopies or substantial portions of the Software.\r\r\n\r\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\r\nSOFTWARE.\r\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A flexible Chat Application for open source software society.",
    "version": "2.1",
    "project_urls": {
        "Download": "https://pypi.org/project/django-chatapp/2.1/",
        "Homepage": "https://github.com/grand-kaveh/django-chat-app"
    },
    "split_keywords": [
        "django",
        "chat",
        "websocket",
        "channels",
        "asgi",
        "vuejs"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a4c3feac8581d213b7f332153d17d6caf1a532a73fd256d28e26c6b0081260da",
                "md5": "73c3975fd7c052b1e32b0f8517531e24",
                "sha256": "c265c74879e54089749e323fe385c5cce2b388bfcc125e7af38f801ba42f9611"
            },
            "downloads": -1,
            "filename": "django_chatapp-2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "73c3975fd7c052b1e32b0f8517531e24",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<=3.12",
            "size": 285365,
            "upload_time": "2025-11-01T11:01:58",
            "upload_time_iso_8601": "2025-11-01T11:01:58.107169Z",
            "url": "https://files.pythonhosted.org/packages/a4/c3/feac8581d213b7f332153d17d6caf1a532a73fd256d28e26c6b0081260da/django_chatapp-2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b41ef852dca5fb8ddad654e698b6916efbbece8b992e4faf1b6e2f895de441b1",
                "md5": "d10808b5dc5734f15f3a82a03241348e",
                "sha256": "31373cecf3ede3484637bafb71a1167935e64103fff0309477a285014ecee6ba"
            },
            "downloads": -1,
            "filename": "django_chatapp-2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d10808b5dc5734f15f3a82a03241348e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<=3.12",
            "size": 278345,
            "upload_time": "2025-11-01T11:02:14",
            "upload_time_iso_8601": "2025-11-01T11:02:14.137637Z",
            "url": "https://files.pythonhosted.org/packages/b4/1e/f852dca5fb8ddad654e698b6916efbbece8b992e4faf1b6e2f895de441b1/django_chatapp-2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-11-01 11:02:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "grand-kaveh",
    "github_project": "django-chat-app",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "asgiref",
            "specs": [
                [
                    "==",
                    "3.5.2"
                ]
            ]
        },
        {
            "name": "backports.zoneinfo",
            "specs": [
                [
                    "==",
                    "0.2.1"
                ]
            ]
        },
        {
            "name": "Django",
            "specs": [
                [
                    "==",
                    "4.1.1"
                ]
            ]
        },
        {
            "name": "Pillow",
            "specs": [
                [
                    "==",
                    "9.2.0"
                ]
            ]
        },
        {
            "name": "sqlparse",
            "specs": [
                [
                    "==",
                    "0.4.2"
                ]
            ]
        },
        {
            "name": "tzdata",
            "specs": [
                [
                    "==",
                    "2022.2"
                ]
            ]
        }
    ],
    "lcname": "django-chatapp"
}
        
Elapsed time: 4.79822s