Skip to content

running Gunicorn with Django Channels2 installed in library got RuntimeError  #515

Description

@DrChai

I have one Django project that is running behind Gunicorn(wsgi) and Channels2(asgi) for handling HTTP and WebSocket separately.
Running Gunicorn would raise a RuntimeError:
RuntimeError( "We detected that you are using Django channels 2.0. To get proper " "instrumentation for ASGI requests, the Sentry SDK requires " "Python 3.7+ or the aiocontextvars package from PyPI." )
Either upgrading to py3.7 or Installing aiocontextvars would not solve the problem.
It looks that _patch_channels()

will be called anyway during initialization, and HAS_REAL_CONTEXTVARS is False because of gevent is installed
Related libraries and versions:
[packages]

Django==2.2.3
channels==2.3.0
aiocontextvars==0.2.2
gevent==1.4.0
gunicorn==19.9.0

[requires]
python_version = "3.6"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions