jayhale / channels-examples-bg-task

A short tutorial for getting background tasks working with Channels in Django
MIT License
26 stars 6 forks source link

Upgrades for Channels 3? #4

Open boonleng opened 3 years ago

boonleng commented 3 years ago

Thanks for sharing this but using this example no longer works today. Was hoping to learn about background task using your example but I receive a RuntimeError: no running event loop with the runworker command. I am using Django 3.2.5 and Channels 3.0.3.

shumakoff commented 3 years ago

I have stumbled upon this issue too.

For me fix was:

  1. Changing the background-tasks': BackgroundTaskConsumer, tobackground-tasks': BackgroundTaskConsumer.as_asgi(),
  2. Downgrading the asgiref package to version 3.3.4 with pip install asgiref==3.3.4