Ratchet.io Plugin for Django

django-ratchet的Python项目详细描述


django ratchet是一个简单的中间件,用于将django应用程序的错误报告给Ratchet.io

要求

django棘轮需要:

  • python 2.6或2.7
  • Django 1.4+
  • 请求0.13.1+
  • 一个Ratchet.io帐户

安装

使用pip安装:

pip install django-ratchet

配置

基本配置需要在settings.py中进行两次更改。

  1. 添加'django_ratchet.middleware.RatchetNotifierMiddleware'作为MIDDLEWARE_CLASSES中的最后一项:

    MIDDLEWARE_CLASSES = (
        # ... other middleware classes ...
        'django_ratchet.middleware.RatchetNotifierMiddleware',
    )
    
  2. RATCHET设置字典添加到settings.py中的某个位置。最低限度是:

    RATCHET = {
        'access_token': '32charactertokengoeshere',
    }
    

Most users will want a few extra settings to take advantage of more features:

RATCHET = {
    'access_token': '32charactertokengoeshere',
    'environment': 'production',
    'branch': 'master',
    'root': '/absolute/path/to/code/root',
}

To make the ^{tt4}$ settings available in your templates as ^{tt7}$, add the context processor:

from django.conf import global_settings
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
  'django_ratchet.context_processors.ratchet_settings',
)

下面是配置变量的完整列表:

访问令牌
从Ratchet.io项目访问令牌
环境

环境名称。最多255个字符的任何字符串都可以。为了获得最佳效果,请在生产环境中使用“production”。

默认值:development如果settings.DEBUGTrueproduction否则

处理程序

其中之一:

  • 阻塞-在主线程中运行
  • 线程–生成新线程
  • 代理–将消息写入日志文件供ratchet-agent

默认值:thread

超时

发送到Ratchet时请求超时(秒)。

默认值:1

应用程序根目录的绝对路径,不包括最后的/。如果您的manage.py/home/brian/www/coolapp/manage.py中,则应将其设置为/home/brian/www/coolapp。GitHub集成所需。
分支
已签出分支的名称。GitHub集成所需。
代理日志文件
如果handleragent,则为日志文件的路径。文件名必须以.ratchet
结尾
终点

URL项目已发布到。

默认值:https://submit.ratchet.io/api/1/item/

网络基础

Ratchet.io Web界面的基本URL。用于“查看棘轮.io”链接。

默认值:https://ratchet.io

修补程序调试视图

如果为true,将修补django.views.debug以在技术500调试错误页上显示“view in ratchet.io”链接。

默认值:True

贡献

欢迎捐款。该项目位于github上的http://github.com/ratchetio/django-ratchet

附加帮助

如果您有任何问题、反馈等,请在support@ratchet.io

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何显示因用户而异的SQLite存储数据?   转换java。sql。将映射传递给Jackon的valueToTree方法时StringNode的时间戳   从java中的列表json获取值   unicode Java字符存储在什么编码中?   java如何让Spring数据存储库中的默认方法命中缓存?   java使用readClassDescriptor()和resolveClass()来允许序列化版本控制   数组通过另一个矩阵的一部分填充矩阵   如果包含使用正则表达式的字符串,则替换父XML标记的java   java清除SharedReference中的单个变量   java将变量值从一个jsp页面传输到另一个jsp页面   java JDBC+SQLite:DriveManager不加载所需的驱动程序   相同源代码的java Kotlin构建生成不同的二进制文件   Java中的元组枚举