def _patch_django_asgi_handler(): # type: () -> None try: from django.core.handlers.asgi import ASGIHandler except ImportError: return if not HAS_REAL_CONTEXTVARS: # We better have contextvars or we're going to leak state between # requests. # # We cannot hard-raise here because Django's ASGI stuff may not be used # at all. logger.warning("We detected that you are using Django 3." + CONTEXTVARS_ERROR_MESSAGE) from sentry_sdk.integrations.django.asgi import patch_django_asgi_handler_impl patch_django_asgi_handler_impl(ASGIHandler)
def _patch_django_asgi_handler(): # type: () -> None try: from django.core.handlers.asgi import ASGIHandler except ImportError: return if not HAS_REAL_CONTEXTVARS: # We better have contextvars or we're going to leak state between # requests. # # We cannot hard-raise here because Django may not be used at all in # the current process. logger.warning( "We detected that you are using Django 3. To get proper " "instrumentation for ASGI requests, the Sentry SDK requires " "Python 3.7+ or the aiocontextvars package from PyPI.") from sentry_sdk.integrations.django.asgi import patch_django_asgi_handler_impl patch_django_asgi_handler_impl(ASGIHandler)