All Projects → Bearle → Django Private Chat

Bearle / Django Private Chat

Licence: isc
Django one-to-one Websocket-based Asyncio-handled chat, developed by Bearle team

Programming Languages

python3
1442 projects

Projects that are alternatives of or similar to Django Private Chat

Bolt Python
A framework to build Slack apps using Python
Stars: ✭ 190 (-49.47%)
Mutual labels:  asyncio, django, websockets
Channelstream
Channelstream is a websocket communication server for web applications
Stars: ✭ 52 (-86.17%)
Mutual labels:  django, chat, websockets
Django Channels React Multiplayer
turn based strategy game using django channels, redux, and react hooks
Stars: ✭ 52 (-86.17%)
Mutual labels:  django, chat, websockets
Hangups
the first third-party instant messaging client for Google Hangouts
Stars: ✭ 1,739 (+362.5%)
Mutual labels:  asyncio, chat
Strawberry
A new GraphQL library for Python 🍓
Stars: ✭ 891 (+136.97%)
Mutual labels:  asyncio, django
Socketshark
A WebSocket message router based on Python/Redis/asyncio
Stars: ✭ 51 (-86.44%)
Mutual labels:  asyncio, websockets
showdown-battle-bot
Socket Battle Bot for Pokemon Showdown (http://pokemonshowdown.com/)
Stars: ✭ 19 (-94.95%)
Mutual labels:  websockets, asyncio
stream video server
demonstrates how to create video streaming server with the help of aiohttp and opencv
Stars: ✭ 15 (-96.01%)
Mutual labels:  websockets, asyncio
chat-with-deno-and-preact
Chat app with Deno + Preact
Stars: ✭ 27 (-92.82%)
Mutual labels:  chat, websockets
Python Slack Sdk
Slack Developer Kit for Python
Stars: ✭ 3,307 (+779.52%)
Mutual labels:  asyncio, websockets
Presentations
Collection of presentations for advanced Python topics
Stars: ✭ 264 (-29.79%)
Mutual labels:  django, websockets
React Redux Chat
🔥🔥react+redux-chat 模仿实现PC微信聊天系统。
Stars: ✭ 308 (-18.09%)
Mutual labels:  chat, websockets
Cryptofeed
Cryptocurrency Exchange Websocket Data Feed Handler
Stars: ✭ 643 (+71.01%)
Mutual labels:  asyncio, websockets
Mangum
AWS Lambda & API Gateway support for ASGI
Stars: ✭ 475 (+26.33%)
Mutual labels:  asyncio, django
Sockjs
SockJS Server
Stars: ✭ 105 (-72.07%)
Mutual labels:  asyncio, websockets
Ring
Python cache interface with clean API and built-in memcache & redis + asyncio support.
Stars: ✭ 404 (+7.45%)
Mutual labels:  asyncio, django
Django Sockpuppet
Build reactive applications with the django tooling you already know and love.
Stars: ✭ 225 (-40.16%)
Mutual labels:  django, websockets
Saea
SAEA.Socket is a high-performance IOCP framework TCP based on dotnet standard 2.0; Src contains its application test scenarios, such as websocket,rpc, redis driver, MVC WebAPI, lightweight message server, ultra large file transmission, etc. SAEA.Socket是一个高性能IOCP框架的 TCP,基于dotnet standard 2.0;Src中含有其应用测试场景,例如websocket、rpc、redis驱动、MVC WebAPI、轻量级消息服务器、超大文件传输等
Stars: ✭ 318 (-15.43%)
Mutual labels:  chat, websockets
Django instagram
Photo sharing social media site built with Python/Django. Based on Instagram's design.
Stars: ✭ 165 (-56.12%)
Mutual labels:  django, websockets
Djangochannelsgraphqlws
Django Channels based WebSocket GraphQL server with Graphene-like subscriptions
Stars: ✭ 203 (-46.01%)
Mutual labels:  django, websockets

============================================= 😎 django-private-chat 😎

.. image:: https://badge.fury.io/py/django-private-chat.svg :target: https://badge.fury.io/py/django-private-chat

.. image:: https://travis-ci.org/Bearle/django-private-chat.svg?branch=master :target: https://travis-ci.org/Bearle/django-private-chat

.. image:: https://codecov.io/gh/Bearle/django-private-chat/branch/master/graph/badge.svg :target: https://codecov.io/gh/Bearle/django-private-chat

Please also check out our another package https://github.com/Bearle/django_mail_admin

Django one-to-one Websocket-based Asyncio-handled chat, developed by Bearle team

.. image:: https://github.com/Bearle/django-private-chat/blob/dev/screenshots/screen_1.jpg?raw=true

Important Notes

This app uses separate management command, run_chat_server for running Websockets in Django context. It is intended to be used with something like Supervisor or Systemd to run asyncio webserver as a separate one from Django. We didn't want our app to be limited to be used together with Django Channels - that's why we did it that way.

You can find an example Systemd config to run it as a service at https://github.com/Bearle/django-private-chat/blob/dev/example.service

P.S. Don't forget to change CHAT_WS_SERVER_HOST && CHAT_WS_SERVER_PORT && CHAT_WS_SERVER_PROTOCOL settings!

Documentation

The full documentation is (finally) at https://django-private-chat.readthedocs.io . You can also check the docstrings & this readme.

Example project

You can check out our example project by cloning the repo and heading into example/ directory. There is a README file for you to check, initial data to check out the chat included.

Customize the templates

How to customize the template? Just copy::

venv/lib/pythonX.X/site-packages/django_private_chat/templates/django_private_chat/dialogs.html
to
yourapp/templates/django_private_chat/dialogs.html

And feel free to edit it as you like! We intentionally left the JS code inside for it to be editable easily.

Existing project quickstart

Install django-private-chat::

pip install django-private-chat

Migrate::

python manage.py migrate django_private_chat

Note: you can use this package with or without uvloop, just run either

.. code-block:: python

python manage.py run_chat_server

or run

.. code-block:: python

python manage.py run_chat_server_uvloop

Add it to your INSTALLED_APPS:

.. code-block:: python

INSTALLED_APPS = (
    ...
    'django_private_chat',
    ...
)

Add the server & port for your asyncio server to settings:

.. code-block:: python

CHAT_WS_SERVER_HOST = 'localhost'
CHAT_WS_SERVER_PORT = 5002
CHAT_WS_SERVER_PROTOCOL = 'ws'

It is possible to change messages datetime format using

.. code-block:: python

DATETIME_FORMAT

Add django-private-chat's URL patterns:

.. code-block:: python

from django_private_chat import urls as django_private_chat_urls


urlpatterns = [
    ...
    url(r'^', include('django_private_chat.urls')),
    ...
]

Add

.. code-block:: python

{% block extra_js %}{% endblock extra_js %}

to your base template

Now you can start a dialog using ::

/dialogs/some_existing_username

To create a WSS (TLS) server instead:

.. code-block:: python

python manage.py run_chat_server "path/to/cert.pem"

(also works with uvloop). The "cert.pem" file should be a plaintext PEM file containing first a private key, then a certificate (may be a concatenation of a .key and a .crt file). Please note that wss will use TLSv1 by default for python 3.5 & 3.4 and will use ssl.PROTOCOL_TLS_SERVER for 3.6 and above. Features

-✅ Uses current app model (get_user_model() and settings.AUTH_USER_MODEL)

-✅ Translatable (uses ugettext and {% trans %} )

-✅ One-to-one user chat

-✅ Works using WebSockets

-✅ Works (optionally) using WSS (TLS) connections (disclaimer - security not guaranteed)

-✅ Displays online/offline status

-✅ Display typing/not typing status

-✅ Soft deletable message model - be sure to keep messages to comply with message-keeping laws

-✅ Flash the dialog button when the user you are not currently talking to wrote you a message

-👉 TODO: add a dialog to the list when new one started

-👉 TODO: add user-not-found and other alerts

-👉 possible Redis backend intergration

Running Tests

Does the code actually work?

::

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Tools used in rendering this package:

  • Cookiecutter_
  • cookiecutter-djangopackage_

.. _Cookiecutter: https://github.com/audreyr/cookiecutter .. _cookiecutter-djangopackage: https://github.com/pydanny/cookiecutter-djangopackage

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].