sentry with django - WBowam/wbowam.github.com GitHub Wiki
Date:2015-08-28
Title: 为django配置sentry
Tags: Django,Sentry
Category:IT
安装sentry
pip install sentry
会自动安装依赖包
配置 sentry
sentry init
`vim ~/.sentry/sentry.conf.py'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.exmail.qq.com'
EMAIL_PORT = 465
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'mypassw'
EMAIL_USE_SSL = True
EMAIL_USE_TLS = False
# The email address to send on behalf of
SENTRY_SERVER_EMAIL = '[email protected]'
SENTRY_ADMIN_EMAIL = '[email protected]'
# You MUST configure the absolute URI root for Sentry:
SENTRY_URL_PREFIX = 'http://123.57.72.210:9000' # No trailing slash!
settings.py
django 相应配置 ## 加入app
INSTALLED_APPS += (
# ....
'raven.contrib.django.raven_compat',
)
## 加入如下中间件404也会触发
MIDDLEWARE_CLASSES += (
'raven.contrib.django.raven_compat.middleware.Sentry404CatchMiddleware',
)
## 从sentry 服务端 sentry.conf.py 中找到SECRET_KEY
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'hHIa+H1LcWPm9bnEWdfvghdfbhfvnfdvondjvndfbviteyobevovfb'
## 配置 dsn(来自服务器端web页面)
RAVEN_CONFIG = {
'dsn': 'http://[email protected]:9000/2',
# If you are using git, you can also automatically configure the
# release based on the git info.
## 可选,信息里会包括代码所在的git commit
'release': raven.fetch_git_sha(os.path.dirname(__file__)),
}
启动celery
sentry celery worker -B
创建数据库,数据表
## 创建好对应的数据库后
sentry syncdb
启动sentry
sentry start