Python django.conf.settings.SENTRY_DSN Examples
The following are 10
code examples of django.conf.settings.SENTRY_DSN().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.conf.settings
, or try the search function
.
Example #1
Source File: views.py From micromasters with BSD 3-Clause "New" or "Revised" License | 6 votes |
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": "", } )
Example #2
Source File: models.py From micromasters with BSD 3-Clause "New" or "Revised" License | 6 votes |
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
Example #3
Source File: context_processors.py From django-react-boilerplate with MIT License | 5 votes |
def sentry_dsn(request): return {"SENTRY_DSN": settings.SENTRY_DSN}
Example #4
Source File: context_processors.py From Wagtail-Pipit with MIT License | 5 votes |
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}
Example #5
Source File: context_processors.py From Wagtail-Pipit with MIT License | 5 votes |
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}
Example #6
Source File: utils.py From arxiv-vanity with Apache License 2.0 | 5 votes |
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()
Example #7
Source File: celery.py From betterself with MIT License | 5 votes |
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)
Example #8
Source File: views.py From micromasters with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #9
Source File: models.py From micromasters with BSD 3-Clause "New" or "Revised" License | 5 votes |
def get_context(self, request, *args, **kwargs): programs = Program.objects.filter(live=True).select_related('programpage').order_by("id") benefits_page = BenefitsPage.objects.filter(live=True).first() 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(HomePage, self).get_context(request) def get_program_page(program): """Return a None if ProgramPage does not exist, to avoid template errors""" try: return program.programpage except ProgramPage.DoesNotExist: return None program_pairs = [(program, get_program_page(program)) for program in programs] context["programs"] = program_pairs 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"] = "" context["coupon_code"] = get_coupon_code(request) context["benefits_url"] = benefits_page.get_url() if benefits_page else "" return context
Example #10
Source File: views.py From micromasters with BSD 3-Clause "New" or "Revised" License | 4 votes |
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": "", } )