Skip to content

Commit

Permalink
Since Django 3 the channels handler is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpirker committed Jun 7, 2024
1 parent c2af1b0 commit 4b5cfba
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sentry_sdk/integrations/django/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,14 @@ def sentry_patched_drf_initial(self, request, *args, **kwargs):
def _patch_channels():
# type: () -> None
try:
# Django < 3.0
from channels.http import AsgiHandler # type: ignore
except ImportError:
return

try:
# DJango 3.0+
from django.core.handlers.asgi import ASGIHandler as AsgiHandler
except ImportError:
return
if not HAS_REAL_CONTEXTVARS:
# We better have contextvars or we're going to leak state between
# requests.
Expand Down

0 comments on commit 4b5cfba

Please sign in to comment.