Bogdanp / Bogdanp/dramatiq_dashboard

Support ASGI so it can be run inside modern Django apps

Open
#9 2 comments 5 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
162
Forks
38
PR merge metrics
No merged PRs in 30d

Description

I'm trying to do something like this in a django app:

At the end of **`myapp/urls.py:`**
```python3
if settings.ENABLE_DRAMATIQ_DASHBOARD:
import dramatiq
from django_wsgi.embedded_wsgi import call_wsgi_app
from dramatiq_dashboard import DashboardApp

app = DashboardApp(broker=dramatiq.get_broker(), prefix='')

def dashboard_proxy_view(request, path: str):
return call_wsgi_app(app, request, path)

urlpatterns = [
re_path('drama/(.*)$', dashboard_proxy_view, name='dramatiq'),
] + urlpatterns
```

The issue is `django_wsgi` and `DashboardApp` both expect `WSGIRequest` objects, which are different from the `ASGIRequest` objects that Django `channels` uses.

I could write a manual translation layer, but maybe you already know of a better way to run this inside a Django app that uses ASGI?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.