Ratchet.io Plugin for Django
django-ratchet的Python项目详细描述
django ratchet是一个简单的中间件,用于将django应用程序的错误报告给Ratchet.io。
安装
使用pip安装:
pip install django-ratchet
配置
基本配置需要在settings.py中进行两次更改。
添加'django_ratchet.middleware.RatchetNotifierMiddleware'作为MIDDLEWARE_CLASSES中的最后一项:
MIDDLEWARE_CLASSES = ( # ... other middleware classes ... 'django_ratchet.middleware.RatchetNotifierMiddleware', )
将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.DEBUG是True,production否则
- 处理程序
其中之一:
- 阻塞-在主线程中运行
- 线程–生成新线程
- 代理–将消息写入日志文件供ratchet-agent
默认值:thread
- 超时
发送到Ratchet时请求超时(秒)。
默认值:1
- 根
- 应用程序根目录的绝对路径,不包括最后的/。如果您的manage.py在/home/brian/www/coolapp/manage.py中,则应将其设置为/home/brian/www/coolapp。GitHub集成所需。
- 分支
- 已签出分支的名称。GitHub集成所需。
- 代理日志文件
- 如果handler是agent,则为日志文件的路径。文件名必须以.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