question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v3.4.x get_running_loop break django-channels runworker

See original GitHub issue

get_running_loop raise RuntimeError with any django-channels runworker command because there is no running event loop…

patch?

diff --git a/asgiref/server.py b/asgiref/server.py
index fb1c394..d1d27f4 100644
--- a/asgiref/server.py
+++ b/asgiref/server.py
@@ -56,8 +56,8 @@ class StatelessServer:
         """
         Runs the asyncio event loop with our handler loop.
         """
-        event_loop = get_running_loop()
-        asyncio.ensure_future(self.application_checker())
+        event_loop = asyncio.get_event_loop()
+        asyncio.ensure_future(self.application_checker(), loop=event_loop)
         try:
             event_loop.run_until_complete(self.handle())
         except KeyboardInterrupt:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

4reactions
bj00rncommented, Jul 1, 2021

I have the same problem in https://github.com/django/channels/issues/1713.

Tested with python 3.8.4 and python 3.10.0 (3.10.0a5)

no problems when asgiref==3.3.4 is installed

1reaction
carltongibsoncommented, Aug 27, 2021

@bj00rn no. Let’s close it here though it’s a channels issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Worker and Background Tasks - Django Channels
The worker/background tasks system in Channels is simple and very fast, and achieves this by not having some features you may find useful,...
Read more >
RuntimeError: no running event loop Djnago runworker
I am deploying my Django app on AWS Ec2 with Apache. I have Asgi and WSGI. I wanna run:
Read more >
Event Loop — Python 3.11.1 documentation
The event loop is the core of every asyncio application. Event loops run asynchronous tasks and callbacks, perform network IO operations, and run...
Read more >
Hacking Django Channels for Fun (and Profit) - Six Feet Up
3 (as of March 2021). The channels package supports a lightweight message passing system (called a channel layer), which allows messages to be ......
Read more >
Getting Started with Django Channels - Real Python
Redis (v3.2.8). Objectives. By the end of this tutorial, you will be able to… Add Web sockets support to a Django ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found