2024-06-02 05:33:04 发布
网友
Sentry从客户端应用程序捕获日志和错误。在
我知道在Sentry中创建项目的唯一方法是在Web应用程序界面中手动提交表单。在
我正在寻找一种从命令行创建一个项目到Sentry的方法(选项,配置文件)?在
这对于部署脚本非常有价值。否则就不可能实现自动化。在
刚在谷歌上找到这个讨论,但没有答案:
https://groups.google.com/d/topic/getsentry/pWglAEHaPUk/discussion
有什么想法吗?在
正如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 = 'admin@localhost' 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(),)
https://docs.getsentry.com/on-premise/server/faq/
它是a django project,当然可以:
from sentry.models import Project project = Project(...) ... project.save()
编辑:您可以write a custom management command在命令行上获得功能
Edit by question的作者:是的,它确实是一个django项目,因此像django项目一样,我通过以下三个步骤自动部署:
像处理任何django项目一样运行dumpdata(sentry将隐式调用管理.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中正式声明的:
https://docs.getsentry.com/on-premise/server/faq/
它是a django project,当然可以:
编辑:您可以write a custom management command在命令行上获得功能
Edit by question的作者:是的,它确实是一个django项目,因此像django项目一样,我通过以下三个步骤自动部署:
像处理任何django项目一样运行dumpdata(sentry将隐式调用管理.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
效果不错。希望这对其他人有帮助。在
相关问题 更多 >
编程相关推荐