Enabling channels leads to SuspiciousFileOperation at /
I noticed that whenever I enable django channels in my code, I get the following error https://drive.google.com/file/d/1YDN8v7rFOsV6jXQseJBCsElXM0pFUC01/view
settings.py:
INSTALLED_APPS = [
"channels",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"debug_toolbar",
"corsheaders",
"rest_framework",
"rest_framework.authtoken",
"core",
"drf_yasg2",
]
WSGI_APPLICATION = "app.wsgi.application"
ASGI_APPLICATION = "app.asgi.application"
asgi.py:
import os
from channels.routing import ProtocolTypeRouter
from django.core.asgi import get_asgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
application = ProtocolTypeRouter({
"http": get_asgi_application(),
# Just HTTP for now. (We can add other protocols later.)
})
Help would be much appreciated.
Thank you in advance!
In my case, the issue was caused by browser cookies, clearing the cookies makes my code work again!