本文整理匯總了Python中django.conf.settings.SENTRY_DSN屬性的典型用法代碼示例。如果您正苦於以下問題:Python settings.SENTRY_DSN屬性的具體用法?Python settings.SENTRY_DSN怎麽用?Python settings.SENTRY_DSN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類django.conf.settings
的用法示例。
在下文中一共展示了settings.SENTRY_DSN屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: terms_of_service
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import SENTRY_DSN [as 別名]
def terms_of_service(request):
"""
Handles the terms of service page
"""
return render(
request,
"terms_of_service.html",
context={
"has_zendesk_widget": True,
"is_public": True,
"js_settings_json": json.dumps({
"release_version": settings.VERSION,
"environment": settings.ENVIRONMENT,
"sentry_dsn": settings.SENTRY_DSN,
"user": serialize_maybe_user(request.user),
}),
"ga_tracking_id": "",
}
)
示例2: get_context
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import SENTRY_DSN [as 別名]
def get_context(self, request, *args, **kwargs):
js_settings = {
"gaTrackingID": settings.GA_TRACKING_ID,
"host": webpack_dev_server_host(request),
"environment": settings.ENVIRONMENT,
"sentry_dsn": settings.SENTRY_DSN,
"release_version": settings.VERSION
}
username = get_social_username(request.user)
context = super().get_context(request)
context["is_public"] = True
context["has_zendesk_widget"] = True
context["google_maps_api"] = False
context["authenticated"] = not request.user.is_anonymous
context["is_staff"] = has_role(request.user, [Staff.ROLE_ID, Instructor.ROLE_ID])
context["username"] = username
context["js_settings_json"] = json.dumps(js_settings)
context["title"] = self.title
context["ga_tracking_id"] = ""
return context
示例3: sentry_dsn
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import SENTRY_DSN [as 別名]
def sentry_dsn(request):
return {"SENTRY_DSN": settings.SENTRY_DSN}
示例4: settings_context_processor
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import SENTRY_DSN [as 別名]
def settings_context_processor(request):
"""
Expose django settings to template engine
"""
parsed_settings = {"DEBUG": settings.DEBUG, "APP_VERSION": settings.APP_VERSION}
if hasattr(settings, "SENTRY_DSN"):
parsed_settings["SENTRY_DSN"] = settings.SENTRY_DSN
if hasattr(settings, "SENTRY_ENVIRONMENT"):
parsed_settings["SENTRY_ENVIRONMENT"] = settings.SENTRY_ENVIRONMENT
return {"SETTINGS": parsed_settings}
示例5: log_exception
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import SENTRY_DSN [as 別名]
def log_exception():
"""
Log an exception that has been raised to the console and Sentry.
Must be called within an `except ...:` statement.
"""
traceback.print_exc()
if settings.SENTRY_DSN:
capture_exception()
示例6: on_configure
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import SENTRY_DSN [as 別名]
def on_configure(self):
client = raven.Client(settings.SENTRY_DSN)
# register a custom filter to filter out duplicate logs
register_logger_signal(client)
# hook into the Celery error handler
register_signal(client)
示例7: standard_error_page
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import SENTRY_DSN [as 別名]
def standard_error_page(request, status_code, template_filename):
"""
Returns an error page with a given template filename and provides necessary context variables
"""
name = request.user.profile.preferred_name if not request.user.is_anonymous else ""
authenticated = not request.user.is_anonymous
username = get_social_username(request.user)
response = render(
request,
template_filename,
context={
"has_zendesk_widget": True,
"is_public": True,
"js_settings_json": json.dumps({
"release_version": settings.VERSION,
"environment": settings.ENVIRONMENT,
"sentry_dsn": settings.SENTRY_DSN,
"user": serialize_maybe_user(request.user),
}),
"authenticated": authenticated,
"name": name,
"username": username,
"is_staff": has_role(request.user, [Staff.ROLE_ID, Instructor.ROLE_ID]),
"support_email": settings.EMAIL_SUPPORT,
"sentry_dsn": settings.SENTRY_DSN,
}
)
response.status_code = status_code
return response
示例8: get
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import SENTRY_DSN [as 別名]
def get(self, request, *args, **kwargs):
"""
Handle GET requests to templates using React
"""
user = request.user
roles = []
if not user.is_anonymous:
roles = [
{
'program': role.program.id,
'role': role.role,
'permissions': [perm for perm, value in available_perm_status(user).items() if value is True]
} for role in user.role_set.all()
]
js_settings = {
"gaTrackingID": settings.GA_TRACKING_ID,
"reactGaDebug": settings.REACT_GA_DEBUG,
"host": webpack_dev_server_host(request),
"edx_base_url": settings.EDXORG_BASE_URL,
"roles": roles,
"release_version": settings.VERSION,
"environment": settings.ENVIRONMENT,
"sentry_dsn": settings.SENTRY_DSN,
"search_url": reverse('search_api', kwargs={"elastic_url": ""}),
"support_email": settings.EMAIL_SUPPORT,
"user": serialize_maybe_user(request.user),
"es_page_size": settings.ELASTICSEARCH_DEFAULT_PAGE_SIZE,
"public_path": public_path(request),
"EXAMS_SSO_CLIENT_CODE": settings.EXAMS_SSO_CLIENT_CODE,
"EXAMS_SSO_URL": settings.EXAMS_SSO_URL,
"FEATURES": {
"PROGRAM_LEARNERS": settings.FEATURES.get('PROGRAM_LEARNERS_ENABLED', False),
"DISCUSSIONS_POST_UI": settings.FEATURES.get('OPEN_DISCUSSIONS_POST_UI', False),
"DISCUSSIONS_CREATE_CHANNEL_UI": settings.FEATURES.get('OPEN_DISCUSSIONS_CREATE_CHANNEL_UI', False),
"PROGRAM_RECORD_LINK": settings.FEATURES.get('PROGRAM_RECORD_LINK', False),
"ENABLE_PROGRAM_LETTER": settings.FEATURES.get('ENABLE_PROGRAM_LETTER', False)
},
"open_discussions_redirect_url": settings.OPEN_DISCUSSIONS_REDIRECT_URL,
}
return render(
request,
"dashboard.html",
context={
"has_zendesk_widget": True,
"is_public": False,
"google_maps_api": False,
"js_settings_json": json.dumps(js_settings),
"ga_tracking_id": "",
}
)