Cannot import ASGI_APPLICATION module while runserver using channels 2 Cannot import ASGI_APPLICATION module while runserver using channels 2 django django

Cannot import ASGI_APPLICATION module while runserver using channels 2


In my case it was wrong import in different file.

What you should do is

python manage.py shellfrom mysite.routing import application

Look what exact error it produces and try to fix that


Just change

ASGI_APPLICATION = mysite.routing.application

to

ASGI_APPLICATION = "routing.application"


Check for any potential errors (maybe import error) in consumers.py. Also, try to put channels as the first item in INSTALLED_APPS in settings.py.

As stated in channels document:

The Channels development server will conflict with any other third-party apps that require an overloaded or replacement runserver command. An example of such a conflict is with whitenoise.runserver_nostatic from whitenoise. In order to solve such issues, try moving channels to the top of your INSTALLED_APPS or remove the offending app altogether.