28👍
This could be due to the fact that the Django and channels versions you have used are not compatible
Try : channels==3.0.4 and django==4.0.0
12👍
At the first:
pip install daphne
pip install channels
And then update setting.py:
INSTALLED_APPS = [
'daphne',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
Just this.
11👍
Had the same with django=4.1.4, channels=4.0.0
My solution:
- install channels with daphne (i did not remove or did anything to previously installed channels; operating in the same venv)
python -m pip install -U channels["daphne"]
- put daphne in INSTALLED APPS, do not put channels there:
INSTALLED_APPS = ( "daphne", "django.contrib.auth",...
- in settings.py add ASGI_APPLICATION:
ASGI_APPLICATION = "myproject.asgi.application"
4👍
From channels 4.0.0 Release Notes documentation:
In order to allow users of other ASGI servers to use Channels without the overhead of Daphne and Twisted, the Daphne application server is now an optional dependency, installable either directly or with the daphne extra, as per the pip example above.
Where Daphne is used daphne>=4.0.0 is required. The channels[daphne] extra assures this.
The runserver command is moved to the daphne package.
In order to use the runserver command, add daphne to your INSTALLED_APPS, before django.contrib.staticfiles:
INSTALLED_APPS = [
"daphne",
…
]
As you can see the runserver command is moved to the daphne package. So you have to install and include it as mentioned here before
- TemplateDoesNotExist at / base.html
- Python/Django "BadStatusLine" error
- Django filter by datetime on a range of dates
- Resolving AmbiguousTimeError from Django's make_aware
0👍
I had the same problem, and found that there was a new release of Channels. Since the project’s Pipfile did not specify a version, it was automatically upgraded.
Maybe you had the same issue, your question was asked 2 days after Channels v4.0 release.
Downgrading to v3.0.5 again solved the problem until I can properly upgrade.
- TypeError: __call__() missing 1 required positional argument: 'send' Django
- Selenium – python. how to capture network traffic's response
- Django dynamic urls
- How to store django objects as session variables ( object is not JSON serializable)?