Sentry捕获来自客户端应用程序的日志和错误。从命令行创建项目
我知道在Sentry中创建项目的唯一方法是在Web应用程序界面中手动提交表单。
我正在寻找一种方法,以任何方式(选项,配置文件)从命令行创建项目入Sentry?
这对于部署脚本将非常有价值。否则,不可能实现自动化。
刚刚发现这个讨论,而周围的Googling,但没有答案:
https://groups.google.com/d/topic/getsentry/pWglAEHaPUk/discussion
任何想法?
Sentry捕获来自客户端应用程序的日志和错误。从命令行创建项目
我知道在Sentry中创建项目的唯一方法是在Web应用程序界面中手动提交表单。
我正在寻找一种方法,以任何方式(选项,配置文件)从命令行创建项目入Sentry?
这对于部署脚本将非常有价值。否则,不可能实现自动化。
刚刚发现这个讨论,而周围的Googling,但没有答案:
https://groups.google.com/d/topic/getsentry/pWglAEHaPUk/discussion
任何想法?
这是a django project,当然你可以:
from sentry.models import Project
project = Project(...)
...
project.save()
编辑:你可以write a custom management command受质疑的作者在命令行上获得的功能
编辑:是的的确是一个Django项目,所以像一个django项目,我自动部署了以下三个步骤:
运行dumpdata就像你使用任何Django项目办(哨兵隐含的调用manage.py):
sentry --config=sentry.conf.py dumpdata --indent=2 auth > auth_data.json
sentry --config=sentry.conf.py dumpdata --indent=2 sentry > sentry_data.json
部署步步:
sentry --config=sentry.conf.py syncdb --noinput
sentry --config=sentry.conf.py migrate
sentry --config=sentry.conf.py loaddata auth_data.json
sentry --config=sentry.conf.py loaddata sentry_data.json
工作得很好。希望这会帮助其他人。
至于正式Sentry's docs说:
# Bootstrap the Sentry environment
from sentry.utils.runner import configure
configure()
# Do something crazy
from sentry.models import Team, Project, User
user = User()
user.username = 'admin'
user.email = '[email protected]'
user.is_superuser = True
user.set_password('admin')
user.save()
team = Team()
team.name = 'Sentry'
team.owner = user
team.save()
project = Project()
project.team = team
project.owner = user
project.name = 'Default'
project.save()
key = ProjectKey.objects.filter(project=project)[0]
print 'SENTRY_DSN = "%s"' % (key.get_dsn(),)
configure()使用默认的sentry conf文件。如何指定/home/me/path/to/my/project/sentry.conf.py? –
快速查看[configure()方法的代码](http://git.io/iwEtlw),建议调用logan.runner.configure_app。另一种解决方案是坚持使用configure()并创建符号链接〜/ .sentry/sentry.conf.py - > /path/to/sentry.conf.py –
看起来像链接已更改为:https:// docs .getsentry.com/on-premise/server/faq/ – abhishekmukherg
我想这可能是过于具体...并不多,甚至会知道什么是哨兵....你可能想提供一个链接至少getsentry.com并可能描述如何通常添加一个项目哨兵,如果有办法做到这一点在python shell或只在他们的管理页面或什么.. –
嗯,这是一个有价值的评论。编辑的问题。 – Arnaud