Skip to content

Do not raise error when channels is not installed #3203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions sentry_sdk/integrations/django/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,14 @@ async def sentry_patched_get_response_async(self, request):
def patch_channels_asgi_handler_impl(cls):
# type: (Any) -> None

import channels # type: ignore
try:
import channels # type: ignore
except ImportError:
channels = None

from sentry_sdk.integrations.django import DjangoIntegration

if channels.__version__ < "3.0.0":
if channels is not None and channels.__version__ < "3.0.0":
old_app = cls.__call__

async def sentry_patched_asgi_handler(self, receive, send):
Expand Down
Loading