本文介绍了Django频道:没有名为"asgiref.sync"的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在遵循此频道指南指南( https://media.阅读thedocs.org/pdf/channels/latest/channels.pdf ),然后在 INSTALLED APPS 的顶部添加频道后,添加 ASGI_APPLICATION ='mysite.routing.application'到我的设置文件,并创建以下 routing.py :

 #.../routing.py从channels.routing导入ProtocolTypeRouter应用程序= ProtocolTypeRouter({#(默认情况下会添加http-&django视图)}) 

运行 python manage.py runserver 后出现此错误:

ModuleNotFoundError:没有名为"asgiref.sync"的模块

我有以下版本的库:

  Django(1.11.5)asgiref(1.1.2)频道(2.0.2)... 

有人可以帮助我吗?我是新来的频道.

解决方案

我发现问题出在 asgiref 的旧版本上,我只需要更新Django,它也更新了asgiref软件包./p>

I am following this guide for channels tutorial (https://media.readthedocs.org/pdf/channels/latest/channels.pdf) and after adding channels to top of INSTALLED APPS, adding ASGI_APPLICATION = 'mysite.routing.application' to my setting file and creating following routing.py:

# .../routing.py
from channels.routing import ProtocolTypeRouter

application = ProtocolTypeRouter({
      # (http->django views is added by default)
})

I am getting this error after running python manage.py runserver:

ModuleNotFoundError: No module named 'asgiref.sync'

I have following versions of libraries:

Django (1.11.5)
asgiref (1.1.2)
channels (2.0.2)
...

Can someone help me ? I am new to channels.

解决方案

I found out the problem was with old version of asgiref I just had to update django and it updated also the asgiref package.

这篇关于Django频道:没有名为"asgiref.sync"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 07:40