Learn Django - Build an Asynchronous Chatroom with Django and Channels

Very Academy · 123K views · 2020 · 1:31:27

Open on YouTube

Web developmentPython, Ruby & scripting languagestutorial

Why Stack Overflow recommends it

Stack Overflow users link it as a learning resource for Django Channels and WebSocket chat apps, both as a starting point for beginners and as the tutorial they followed when debugging handshake errors.

Recommended by 2 people across 2 different months, 2021 to 2023.

What it is

A 1.5-hour Django tutorial from Very Academy that covers the theory behind WebSockets, ASGI and Django Channels, then builds a real-time chatroom step by step. It walks through routing, consumers, the front-end and channel layer configuration with optional Redis.

What people said

Recommends Sanket Nawale · 2021-03 · Stack Overflow · on “Error in Django Channel during WebSocket handshake: Unexpected response code: 500”

I was following the this [this video] tutorial on youtube. The browser gives an error "(index):21 WebSocket connection to 'ws://127.0.0.1:8000/ws/chat/asas/' failed: Error during WebSocket handshake: Unexpected response code: 500 (anonymous) @ (index):21" Code: chatroom.html <script> const roomName = JSON.parse(document.getElementById('room-name').textContent); const chatSocket = new WebSocket( 'ws://' + window.location.host + '/ws/chat/' + roomName + '/' ); chatSocket.onmessage = function (e) { const data = JSON.parse(e.data); console.log(data) document.querySelector("#user-hello").innerHTML = (data.tester) } </script> chat/routing.py from django.urls import re_path from . import consumers webso

Recommends Om Kashyap · 2022-06 · Stack Overflow · on “how to get messages (data) in real time from database using ajax and django”

I cannot teach you asynchronous and channels here buddy . I have started learning this from this [this video] youtube video of very academy. its great . have a loook

Cites user21744561 · 2023-07 · Stack Overflow · on “"WebSocket connection to 'ws://localhost:8000/ws/chat/cujncvifd/' failed"”

I am getting a "WebSocket connection to 'ws://localhost:8000/ws/chat/cujncvifd/' failed" error in my django application. I am also getting a "Not Found: /ws/chat/cujncvifd/" statement in the terminal. The following are the relevant pieces of code from the mentioned files: settings.py: INSTALLED_APPS = [ 'channels', 'common_anime_chat.apps.CommonAnimeChatConfig', 'users.apps.UsersConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] ASGI_APPLICATION = 'anime_chat_app.routing.application' CHANNEL_LAYERS = { 'default':{ "BACKEND":"channels.layers.InMemoryChannelLayer" } } asgi.