本文整理汇总了Python中tornado.web.Application.sentry_client方法的典型用法代码示例。如果您正苦于以下问题:Python Application.sentry_client方法的具体用法?Python Application.sentry_client怎么用?Python Application.sentry_client使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tornado.web.Application
的用法示例。
在下文中一共展示了Application.sentry_client方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: app
# 需要导入模块: from tornado.web import Application [as 别名]
# 或者: from tornado.web.Application import sentry_client [as 别名]
def app(name, settings):
u"""起動するアプリケーションをロードする
"""
options.log_file_prefix = settings["logging_path"]
logging.getLogger().setLevel(settings['logging_level'])
models.load(settings['db'])
with open(settings['server_apps_conf_path'], 'r') as f:
app_conf = yaml.load(f)
server = app_conf['common'][name]
if settings['env'] in app_conf:
server.update(app_conf[settings['env']][name])
ui = {'ui_modules': {}, 'ui_methods': {}}
for ui_key in ui.keys():
for package in server.get(ui_key, {}).keys():
for key in server[ui_key][package].keys():
name = server[ui_key][package][key]
module= importlib.import_module("mylib.%s.%s" % \
(ui_key, package))
ui[ui_key].update({key: getattr(module, name)})
settings.update(ui)
routes = []
for package in server['handlers'].keys():
for uri in server['handlers'][package].keys():
name = server['handlers'][package][uri]
handler = importlib.import_module("handlers.%s" % package)
routes.append((r"%s" % uri, getattr(handler, name)))
application = Application(routes, **settings)
try:
application.sentry_client = AsyncSentryClient(settings['sentry'])
except:
pass
return dict(
app = application,
port = server['port'],
worker = server['worker_processes']
)
示例2: main
# 需要导入模块: from tornado.web import Application [as 别名]
# 或者: from tornado.web.Application import sentry_client [as 别名]
def main(ctx, config, daemon, pidfile,
stdin, stdout, stderr, directory, umask):
"""Entry of Blackgate command."""
if not config:
config = read_default_config()
else:
config = read_yaml_config(config)
if not config:
ctx.fail('config not found.')
try:
config = parse_yaml_config(config)
except ValueError:
ctx.fail('config is not valid yaml.')
component = Component()
component.configurations = config
component.install()
application = Application(component.urls)
# FIXME: is there a better place to put this piece of code?
if component.configurations.get('sentry'):
try:
from raven.contrib.tornado import AsyncSentryClient
dsn = component.configurations.get('sentry', {}).get('dsn')
if dsn:
application.sentry_client = AsyncSentryClient(dsn)
except ImportError:
ctx.fail('You have configured `sentry`, but `raven` library not detected. Try `pip install raven`.')
server = Server(pidfile, stdin, stdout, stderr, directory, umask)
server.set_app(application)
server.set_port(config.get('port') or 9654)
ctx.obj = {}
ctx.obj['server'] = server
ctx.obj['daemon'] = daemon