Can't connect django with javascript on non localhost ip address

I am trying to connect javascript to django. And I am hosting my django web app on
What I actually want is for local network devices to connect as well there they are able to access my website using my internal ip address and port. like

The problem is I am using Websocket currently. And while the websockets are connecting on localhost:8000. But they are not connection on the above mentioned ip address.

COrs is setup. I just want to make this django project a little less secure because I only want to show the implementation I am not concerned about the security right now.
DEBUG = True

# Application definition

    # Third Party Apps
    # 'corsheaders'


ROOT_URLCONF = 'chat_room.urls'

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [

WSGI_APPLICATION = 'chat_room.wsgi.application'
ASGI_APPLICATION = "chat_room.asgi.application"

    "default": {
        "BACKEND": "channels_redis.core.RedisChannelLayer",
        "CONFIG": {
            "hosts": [(config("REDIS_HOST",''), config("REDIS_PORT",'6379'))],
... A lot more unimportant things

import os

from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from import AllowedHostsOriginValidator
from django.core.asgi import get_asgi_application

from chat.routing import websocket_urlpatterns

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
django_asgi_app = get_asgi_application()

application = ProtocolTypeRouter(
        "http": django_asgi_app,

class ChatConsumer(AsyncWebsocketConsumer):
    async def connect(self):
        self.room_name = self.scope["url_route"]["kwargs"]["room_name"]
        self.room_group_name = f"{self.room_name}"
        self.current_channel_name = self.scope["url_route"]["kwargs"]["channel_name"]

        await self.channel_layer.group_add(self.room_group_name, self.channel_name)
        await self.accept()

    async def disconnect(self, close_code):
        await self.channel_layer.group_discard(self.room_group_name, self.channel_name)

    async def receive(self, text_data):
        data = json.loads(text_data)
        message = data['message']
        receiver_channel_name = data['receiver_channel_name']

        await self.channel_layer.group_send(self.room_group_name, {
            "type": "chat.message",

    async def chat_message(self, event):
        message = event['message']
        if event["to"] == self.current_channel_name:
            await self.send(text_data=json.dumps({
                'message': message

I have faced this problem in Rest Framework as well. There I just set the AUthentication and Permission classes to empty lists. Then The javascript connections worked. But here I don’t have a clear Idea of what to do.
Again I do not care much about security at the current moment and would like to use this freeely.
Thanks for any help in advance.

Please post your websocket_urlpatterns and the command line you’re using to run Daphne.

Also, your definition for the CHANNEL_LAYER is incorrect. See the docs at Channel Layers — Channels 4.0.0 documentation

websocket_urlpatterns = [
re_path(r"ws/chat/(?P<room_name>\w+)/(?P<channel_name>\w+)/$", consumers.ChatConsumer.as_asgi()),

I am using python .\ runserver
I am not using a specific command to run daphne, It is being taken care of from above only.

One more thing I want to add.
I saw that

await self.channel_layer.group_add(self.room_group_name, self.channel_name)

When I comment above line, the connection is established though I cannot sent messages. Meaning group creation is actually causing the problems.

Did you fix the CHANNEL_LAYERS definition as I pointed out above?

I found the solution, actually the connection to me Redis was failing due to which groups were not made and ultimately websockets were denied.everything is working fine now