一个用于聊天的Django应用程序
django-vestlus的Python项目详细描述
詹戈·维斯特勒斯
vestlus是一个django聊天应用程序,支持私人和公共频道。在
依赖性
使用vestlus需要:
django-polymorphic
:用于处理消息模型之间的继承。在django-crispy-forms
:用于更好地格式化模板中的表单。在django-restframework
:用于提供restapi支持。在django-haystack
:用于处理跨通道和消息的搜索。在
这些应用程序需要安装在django项目的INSTALLED_APPS
元组中。在
型号
该应用程序分为三种主要模式:
- channel:频道允许群组对话。发送到频道的任何消息 对通道的每个成员都可见。频道可以是公共的,也可以是私有的。在
- membership:成员资格允许用户加入、退出和管理频道。 所有者和管理员可以管理频道成员身份。在
- message:所有消息都是私有的(自对自);私有的(与其他人共享);或者
安装
- 将vestlus添加到您的
INSTALLED_APPS
设置中,如下所示:
INSTALLED_APPS=[# other apps...'vestlus',]
INSTALLED_APPS
设置中,如下所示:或者,您也可以这样添加此应用程序::
^{pr2}$- 在您的项目中包含轮询URLconf网址.py像这样:
path('chat/',include('vestlus.urls',namespace='vestlus')),
2.1条。也可以选择在项目中添加api端点网址.py是这样的:
path('api/',include('vestlus.api',namespace='vestlus_api')),
- 在
运行
在python manage.py migrate
创建应用程序模型。在 - 在
启动开发服务器并访问^{
在} 开始添加聊天组和消息(你需要启用管理应用程序)。在 - 在
访问^{
在} 使用该应用程序。应将以下url添加到url方案中:
http://127.0.0.1:8000/chat/
http://127.0.0.1:8000/chat/channels/
http://127.0.0.1:8000/chat/channels/new/
http://127.0.0.1:8000/chat/channels/<slug:slug>
http://127.0.0.1:8000/chat/channels/<slug:channel>/messages/<slug:slug>/delete
http://127.0.0.1:8000/chat/channels/<slug:slug>/delete
http://127.0.0.1:8000/chat/channels/<slug:slug>/messages/new/
http://127.0.0.1:8000/chat/memberships/
http://127.0.0.1:8000/chat/memberships/<slug:slug>
http://127.0.0.1:8000/chat/memberships/<slug:slug>/new/
http://127.0.0.1:8000/chat/messages/
http://127.0.0.1:8000/chat/messages/<slug:slug>
http://127.0.0.1:8000/chat/messages/<slug:slug>/delete
5.1条。如果还包含了api URL,则可以通过访问以下方式访问端点:
http://127.0.0.1:8000/api/channels
http://127.0.0.1:8000/api/channels/<pk>
http://127.0.0.1:8000/api/channels/<uuid>
http://127.0.0.1:8000/api/channels/<pk>/messages
http://127.0.0.1:8000/api/channels/<uuid>/messages
http://127.0.0.1:8000/api/channels/me
http://127.0.0.1:8000/api/group-messages
http://127.0.0.1:8000/api/group-messages/<pk>
http://127.0.0.1:8000/api/memberships
http://127.0.0.1:8000/api/memberships/<uuid>
http://127.0.0.1:8000/api/messages
http://127.0.0.1:8000/api/messages/<pk>
http://127.0.0.1:8000/api/messages/notes
许可证
vestlus是BSD-Licensed。在
用django-clite构建。在
由Leo Neto开发和维护
- 项目
标签: