Django Channels Tutorial 🔥: the most minimal Real Time app (not Chat) | Django WebSockets

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ธ.ค. 2024

ความคิดเห็น • 197

  • @seanicus100
    @seanicus100 ปีที่แล้ว +3

    For anyone who isn't getting the "Starting ASGI/Channels" when starting up Django, but instead is getting the normal "Starting development server", I was able to resolve that problem by installing the *same* versions of django and channels to the virtual environment, because it looks like there was a change since this video came out.
    I did
    pip install django==3.1.4
    pip install channels==3.0.2
    The other dependencies didn't seem to be an issue even though they didn't match what was in the output of this video but in a few years it may be necessary to specify those as well.
    Great video but tutorials like this ought to specify what versions they use, for future users.

  • @MrTdhillon
    @MrTdhillon 3 ปีที่แล้ว +45

    Thank you for making a non-chat tutorial!

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว +3

      Thank you for watching!

    • @MrTdhillon
      @MrTdhillon 3 ปีที่แล้ว +1

      @Red Eyed Coder Club I have a question. What would make this code/example work with multiple requests? I’m working on an app which has somewhat of a dashboard where multiple users can pick things from a list. This example works great but I was wondering what it takes for multiple users to interact

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว +1

      @@MrTdhillon try to follow the other Django Channels videos. It's just a very basic example.

  • @Saheryk
    @Saheryk 3 ปีที่แล้ว +1

    Man, that's how tutorials should be - bare minimum to run anything, no matter how ugly it is. Literally not a single unnecessary thing. Thanks, you rock.

  • @hmoazed
    @hmoazed 3 ปีที่แล้ว +9

    I found several tutorials for Django Channels, and they were all so convoluted I was about to give up. Thank haven I found your tutorial, it is so well laid out and easy to follow, thank you so much!!!

  • @ADL1422
    @ADL1422 2 ปีที่แล้ว +2

    That was already said but it's a real pleasure to find somebody who shows only a simple websocket. Thanks !

  • @face_control14
    @face_control14 ปีที่แล้ว +4

    For those who do not run "Starting ASGI/Channels",
    1) remove "channels" (pip uninstall channels)
    2) pip install channels["daphne"]
    3) replace "channels" in INSTALLED_APPS with "daphne", and move it to the very top of the list
    4) Many thanks to Oleg for developing the skill of finding and eliminating errors

    • @jasmeetpabla378
      @jasmeetpabla378 ปีที่แล้ว

      Thanks a lot. It helps me.

    • @javierzheng5979
      @javierzheng5979 ปีที่แล้ว

      Thanks a lot. I spent time in Cursor and chatGPT and still cannot get a useful solution for this.

    • @ritiktyagi1926
      @ritiktyagi1926 ปีที่แล้ว

      Many thanks, kind sir.

    • @khoaavan8075
      @khoaavan8075 ปีที่แล้ว

      Thanks a lot, good luck to you

    • @zholdanimelyrics4276
      @zholdanimelyrics4276 ปีที่แล้ว

      You are an incredible human being, all the luck in the world to you!

  • @RedEyedCoderClub
    @RedEyedCoderClub  4 ปีที่แล้ว +5

    What video should I make next? Any suggestions? *Write me in comments!*
    Follow me @:
    Telegram: t.me/red_eyed_coder_club
    Twitter: twitter.com/CoderEyed
    Facebook: fb.me/redeyedcoderclub
    Help the channel grow! Please Like the video, Comment, SHARE & Subscribe!

  • @AdityaSingh-qc4xd
    @AdityaSingh-qc4xd 3 ปีที่แล้ว +3

    In most of django channels tutorials they are just making the chat app using django channels documentation they dont even know what they are doing what they are importing why they are importing that middleware and as a beginner it was very confusing for me but your simple and basic video was very helpul and it explained me a lot So thank you for making this video.

  • @MrYoklmn
    @MrYoklmn 4 ปีที่แล้ว +17

    Олег, спасибо! Всегда круто и понятно!)

  • @afrasiyabkakakhel4643
    @afrasiyabkakakhel4643 3 ปีที่แล้ว +2

    Man. This was one of the best tutorials I ever came across. Thank you so much.

  • @artemdyrdin6150
    @artemdyrdin6150 3 ปีที่แล้ว +1

    This video is best for beginners. I am from Russia, but I got everything. Thanks!

  • @mrigendraprasad1877
    @mrigendraprasad1877 3 ปีที่แล้ว +3

    Your voice is like watching django channels on discovery channel
    Thanks for the tutorial

  • @dchiquinho4885
    @dchiquinho4885 ปีที่แล้ว

    Hello, nice video, do you use Redis? Is it necessary? thanks

  • @jasmeetpabla378
    @jasmeetpabla378 ปีที่แล้ว

    Thanks a lot for explaining so clearly the basics of django channels and web sockets.

  • @TdadadT9
    @TdadadT9 4 ปีที่แล้ว +3

    Thanks a lot! I really waited this topic so much! Glad to see it right here.

  • @Tuxcz
    @Tuxcz 2 ปีที่แล้ว

    First example out of many that's clear to me. Thank you.

  • @FreeDomSy-nk9ue
    @FreeDomSy-nk9ue 3 ปีที่แล้ว

    Awesome stuff. It's so rare to find tutorials about Django Channels.

  • @ivanmaslennikov8415
    @ivanmaslennikov8415 2 ปีที่แล้ว

    Thank you!
    Really necessary minimum for understanding Django channels basics.

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 ปีที่แล้ว

      Thank you! Glad that it was helpful. Have a nice day!

  • @bipulkalita5780
    @bipulkalita5780 2 ปีที่แล้ว

    yes, we need the spark and you just gave it. Awesome video.

  • @katata4742
    @katata4742 3 ปีที่แล้ว

    first thanks that was short to the point loved it now just asking doesn't this mean its now possible to call objects from the model in just similar manner or their is additional stuff ...

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      Not sure that got you correctly. Did you watch my other Django Channels videos?

  • @BMAKAUSTUBHVERMA
    @BMAKAUSTUBHVERMA 2 ปีที่แล้ว

    yeah boiii, finally some minimal real time app

  • @vivo0304
    @vivo0304 ปีที่แล้ว

    Man the best tutorial that I find in youtube! Do you have a git rep link of this project?
    Thanks!

  • @user-wl6gd5xh1t
    @user-wl6gd5xh1t 2 ปีที่แล้ว

    Thanks for the tutorial, I have a question, which address should I listen to if we talk about the server, and maybe what should I change in credentials for server work, not localhost? (in my case frontend at another server and it should listen for the websocket)

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 ปีที่แล้ว

      Sorry for the late answer. The websocket have to listen the IP of your server from where it gets data. The localhost is 127.0.0.1 IP address, and so there is no much difference here. But it's probably necessary to take into consideration the cross origin requests problem.

    • @user-wl6gd5xh1t
      @user-wl6gd5xh1t 2 ปีที่แล้ว

      @@RedEyedCoderClub thanks for the answer, I already found out how to solve it. In settings.py I changed 127.0.0.1:8000 into 0.0.0.0:8000, and it starts work. And yeah, cross origin was too, but it wasn't big trouble)) Right now it's working, but a little bit slow(I send some requests to another server, for about 20 requests per minute), trying to find out how to make it faster

  • @tazul8
    @tazul8 ปีที่แล้ว

    Very useful tutorial. A lot of thanks.

  • @ДмитрийСиняков-я1ф
    @ДмитрийСиняков-я1ф 3 ปีที่แล้ว +1

    Удивительно, я английский так сяк знаю, но тебя почему-то понимаю...)))) Спасибо за ролик!!!

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      Because of my pronunciation :)

    • @veirant5004
      @veirant5004 3 ปีที่แล้ว

      @@RedEyedCoderClub, you have not so many flaws, though. There happens a slight confusion with British and American pronounciation (in some places, you read "r", despite it is implied that you will omit it in British (some kind of subtitution to a long "a"), or vice versa stretching vowels as Americans would do it) and too strong consonants (t, d, r mostly) when control over the tongue weakens a little.
      Thanks for the video!

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      @@veirant5004 Thank you very much! I will work on it :)

  • @rezakhalafi528
    @rezakhalafi528 ปีที่แล้ว

    That is simple and undestandble. You are amazing teacher. Thank you so much.

  • @klduck2468
    @klduck2468 3 ปีที่แล้ว

    This answered many questions i have. Thanks Red!

  • @forentrepreneurs3852
    @forentrepreneurs3852 3 ปีที่แล้ว

    such a great tutorial! well thought approach for leaners new to channels concept!

  • @OnyxBloodStone
    @OnyxBloodStone 3 ปีที่แล้ว

    Do you know about rooms in SocketIO? Is there an equivalent to that in Channels?

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      I know about rooms. Did you watch my other Channels videos?

  • @codedjango
    @codedjango 4 ปีที่แล้ว

    Great tutorial, but I would like to understand its use-case - where do you think we could apply this logic for practically implementing it? Maybe "Chat" application? but here you are sending messages from server(django) to client(browser) using the "onmessage" method of WebSockets...and chat has to be between 2 clients(browser instances) I believe....Hence, if you could explain its practical use-case, maybe I will be able to relate it better...Anyways, thanks a lot for this tutorial.

    • @RedEyedCoderClub
      @RedEyedCoderClub  4 ปีที่แล้ว +3

      This example has no practical use case. It's just an example of how to use Django Channels. Nothing more. I'll make more useful videos a bit later.

    • @marcinszydowski5563
      @marcinszydowski5563 2 ปีที่แล้ว

      It can be very useful to simulate a real-time processes for learning purposes (or even be programs for managing such processes itself if requirements will be easy). Imagine to write an app for students to show them how to monitor water system in the city or temperature in a steel mill, or even getting the overall state of a car during driving. In all cases sensors (consumers) emit data and there's need to display such informations (as they are or processed) on screens in a control rooms and panels.

  • @AbzalAmeer
    @AbzalAmeer 3 ปีที่แล้ว

    thank you for this tutorial! It was very helpful to understand the basics of channels.

  • @omarnomad
    @omarnomad 4 ปีที่แล้ว

    Very cool. Will you make it in the future to support multiple clients?

    • @RedEyedCoderClub
      @RedEyedCoderClub  4 ปีที่แล้ว +2

      The next video in the series with a project, that supports multiple clients.

    • @omarnomad
      @omarnomad 4 ปีที่แล้ว

      @@RedEyedCoderClub Hey, looking forward to it! Thanks for replying. Have a nice day!

    • @RedEyedCoderClub
      @RedEyedCoderClub  4 ปีที่แล้ว

      Thank you!

  • @brahimboughanam1662
    @brahimboughanam1662 3 ปีที่แล้ว

    Really a was needed this thank you man

  • @MadhanMohanReddyB
    @MadhanMohanReddyB 3 ปีที่แล้ว

    Fantastic work!!! very simple and easy to follow. Thank you so much.

  • @lunaRdeltaY
    @lunaRdeltaY 2 ปีที่แล้ว

    thx a lot sir, i know the differences of concept between http and web socket but your video tells how to implement, in a very clean way! really helps for newbie like me. But sir i have a question, if i wish to push data into multiple mobile apps (developed with flutter) at the same time, how can i do that?

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 ปีที่แล้ว

      Try to watch next video about broadcasting. It has the answer on you question.

  • @noobstack3498
    @noobstack3498 3 ปีที่แล้ว

    simple and complete .. love u ..

  • @alexdin1565
    @alexdin1565 2 ปีที่แล้ว

    Hi, can we scrape data and display data scrapped in real-time in place of your random numbers?

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 ปีที่แล้ว +1

      Hi, I have 4 videos about Django Channels.
      The last one is about sending requests to an API (using Celery BTW), and rendering data in real-time.
      The video:
      th-cam.com/video/wos1uhnd3qM/w-d-xo.html

    • @alexdin1565
      @alexdin1565 2 ปีที่แล้ว

      @@RedEyedCoderClub thanks, This is why you are the best

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 ปีที่แล้ว

      Thank you!

  • @nirutg5130
    @nirutg5130 3 ปีที่แล้ว

    Thank you very much for Great example bro😊.

  • @RichardFirOey
    @RichardFirOey 3 ปีที่แล้ว +1

    For everyone who wants to know the simple higher concept of Django Channels, I suggest you to watch this video first ! Then, you could continue other advanced technique with ease.

  • @geektom8898
    @geektom8898 2 ปีที่แล้ว

    Thanks for this Amazing tut please how we can send data from view to consumer

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 ปีที่แล้ว +1

      Thank you. Didn't get what you want to achieve. Can you elaborate it a bit?

    • @geektom8898
      @geektom8898 2 ปีที่แล้ว

      @@RedEyedCoderClub thanks for your reply I very much appreciate it,
      I'm a newbie in Django I like your tutorials
      I created a small app where anyone comes and types a keyword on the form (on the index.html page) and I created a python function that takes this keyword and scraps data from the web and returns the result to the user it returns many titles ['title1','title2','title3','title4', ......].
      when I saw your real-time app I like it and I hope to display my scraped data like you do one by one don't wait for the function to scrap all titles.

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 ปีที่แล้ว

      This video is just a demonstration of very basic using of Django Channels. More complicated staff I put in other videos.
      Did you watch my other videos about using of Django Channels?
      They have the answer to your question. Consider of watching them, please.
      Than you for your comment, and have a nice day!

  • @mukulkumar8188
    @mukulkumar8188 3 ปีที่แล้ว

    What if I refresh the page, there is no disconnect method in the consumer. Can you help me to understand what can I write in disconnect method.

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      In disconnect method usually is the logic of quitting from a group/channel and regarding stuff.

  • @robertcepero5598
    @robertcepero5598 3 ปีที่แล้ว

    Thank you for the detailed info!

  • @Letop5suryoutube
    @Letop5suryoutube 3 ปีที่แล้ว +1

    Thank you

  • @mozzaminamdar7143
    @mozzaminamdar7143 2 ปีที่แล้ว

    what if we refresh the page?? the connection is going to fail or it will reconnect??

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 ปีที่แล้ว

      It should reconnect but it won't, because it's a very basic example. Consider of watching my other Django Channels video.

  • @davidmaillot4283
    @davidmaillot4283 3 ปีที่แล้ว

    Thank you, I used it for a real time trading app 👍

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 ปีที่แล้ว

      Thanks for watching and for your comment!

  • @gus_gus_
    @gus_gus_ 2 ปีที่แล้ว

    works great, but when I close the window and then reopen the same window, page doesn't work. I think I need another function when is disconnect

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 ปีที่แล้ว

      It's just the most minimal example. Did you try another videos of the series?

  • @LNMaster_
    @LNMaster_ 3 ปีที่แล้ว

    Thank you very much, simple and understandable, I like yours 'визги' and 'асги' )

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว +1

      Thanks. I guess it's the right pronunciation according to the en.wikipedia.org/wiki/Web_Server_Gateway_Interface

    • @LNMaster_
      @LNMaster_ 3 ปีที่แล้ว +1

      @@RedEyedCoderClub let urlPath = '{{ url }}'
      urlPath = urlPath.replace(/http|https/, 'ws')
      const socket = new WebSocket(`${urlPath}ws/example`)
      I think this JS websocket connection pattern more flexible, what's your opinion ? I am not an Python developer, used request.build_absolute_uri(),

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      yep, you are right

  • @technicalilm8999
    @technicalilm8999 2 ปีที่แล้ว

    Can asgi and wsgi run at the sametine ?

  • @jansgreen4650
    @jansgreen4650 2 ปีที่แล้ว

    How do I pass that data to the live html?

  • @athuldas8689
    @athuldas8689 3 ปีที่แล้ว

    How can we use the same on server, its not connecting

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      This example is not for production, consider watching of my other Django Channels videos.

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      Thanks for comment

  • @noru.sketch
    @noru.sketch 2 ปีที่แล้ว

    Can python be used as a client?

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 ปีที่แล้ว

      Actually no, but Python code can be compiled to JS, and this allows to use Python on frontent.

  • @TheUltimateNoobHD
    @TheUltimateNoobHD ปีที่แล้ว

    why do you use redis?

  • @ommahajan1
    @ommahajan1 3 ปีที่แล้ว

    Thank you a lot. I really wanted this!!

  • @caipeiyuan5391
    @caipeiyuan5391 3 ปีที่แล้ว

    It‘s a great tutorial.
    Could you upload the demo code to the github?
    Thank you a lot.

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      The project has the minimum of Python and JS code.

  • @devmrnecro4215
    @devmrnecro4215 3 ปีที่แล้ว

    Can anybody tell me why we do need to use json here? Like for what purposes we use that?

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      JSON is convenient data format. That's why.

  • @nootherkyle
    @nootherkyle 3 ปีที่แล้ว

    man you nailed it

  • @AliAbdullah-oi3wc
    @AliAbdullah-oi3wc 3 ปีที่แล้ว

    Why can't you load the site in another tab? It's blocking any new requests?

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว +1

      It just can't handle the second request, because it's fully synchronous app.

  • @ugursakarya8995
    @ugursakarya8995 3 ปีที่แล้ว

    I have this error " Import "django.core.asgi" could not be resolved from source " when I write the ' django.core.asgi ' . How ı can solve this problem. pls help

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      What are you doing? What do you want to achieve?

  • @ehsanmatari2819
    @ehsanmatari2819 3 ปีที่แล้ว

    Great video, Thanks a lot. 🙌

  • @liorbm1
    @liorbm1 3 ปีที่แล้ว

    Its great, but how to close the connection ?

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      Try to call the self.close() method in the connect method

  • @UMBERTOartS7
    @UMBERTOartS7 3 ปีที่แล้ว

    and for deploy this project?

  • @supritkumar2624
    @supritkumar2624 3 ปีที่แล้ว

    Listen failure: Couldn't listen on 127.0.0.1:8000: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted.

  • @rajeshthoomu3297
    @rajeshthoomu3297 2 ปีที่แล้ว

    1000th like🙂

  • @guenterbailey5974
    @guenterbailey5974 3 ปีที่แล้ว

    Wow, realy easy and tiny. 👍

  • @fabianhaukhopland6713
    @fabianhaukhopland6713 3 ปีที่แล้ว

    Nice video, thanks

  • @naeemnawaz4590
    @naeemnawaz4590 3 ปีที่แล้ว

    please anyone
    ERROR is
    django.core.exceptions.ImproperlyConfigured: Cannot import ASGI_APPLICATION module 'startup.asgi'

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      check your code or start a new project from scratch. I've got the same bug one time.

  • @aayushpatil7514
    @aayushpatil7514 4 ปีที่แล้ว

    Ok but can you make a scalable video chatting app with this

    • @RedEyedCoderClub
      @RedEyedCoderClub  4 ปีที่แล้ว

      I'll make a video about chatting app, but it'll be a bit later. It'll be the video #5 in the Channels topic.

  • @franco_bsnss7482
    @franco_bsnss7482 4 หลายเดือนก่อน

    Bro you just took the job of the Usestates in React..

  • @radeshf
    @radeshf 3 ปีที่แล้ว

    very useful, tank you

  • @thiagocnunes
    @thiagocnunes 3 ปีที่แล้ว

    Amazing , tks a lot!

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      Thanks for watching and have a nice day!

  • @Aiminsun
    @Aiminsun 3 ปีที่แล้ว

    Great video, Thanks a lot ^_^

  • @Tom.A.
    @Tom.A. 3 ปีที่แล้ว

    Nice!

  • @alexle3598
    @alexle3598 2 ปีที่แล้ว

    its not working with https

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 ปีที่แล้ว

      :D It's just an example, demonstrating the basic principle.

    • @alexle3598
      @alexle3598 2 ปีที่แล้ว

      @@RedEyedCoderClub ok. how to remove client limitations?

  • @aashayamballi
    @aashayamballi 3 ปีที่แล้ว

    Thank you!

  • @mahmoudbechki8210
    @mahmoudbechki8210 3 ปีที่แล้ว

    thank you so much

  • @alfonzotamano6209
    @alfonzotamano6209 ปีที่แล้ว

    jared yambao gusto mag lig pero wala pang comment

  • @nagarajkalakutagi5717
    @nagarajkalakutagi5717 3 ปีที่แล้ว

    Thank you sir

  • @bahakulbarakov494
    @bahakulbarakov494 4 ปีที่แล้ว +1

    Спасибо за ролик! У меня английски не на уровне, но я все понял

  • @N10-b8f
    @N10-b8f 4 ปีที่แล้ว

    Please make Django chat app

    • @RedEyedCoderClub
      @RedEyedCoderClub  4 ปีที่แล้ว

      Of course, but a bit later

    • @N10-b8f
      @N10-b8f 4 ปีที่แล้ว +1

      @@RedEyedCoderClub by the way your content is amazing keep it up!!!

    • @RedEyedCoderClub
      @RedEyedCoderClub  4 ปีที่แล้ว

      Thank you!

  • @rakeshnagarajan7701
    @rakeshnagarajan7701 2 ปีที่แล้ว

    6:10 video starts

  • @egorkomarov4719
    @egorkomarov4719 3 ปีที่แล้ว +1

    Когда будут видосы на русском?

  • @vitalii7672
    @vitalii7672 3 ปีที่แล้ว

    спасибо большое

  • @bahakulbarakov494
    @bahakulbarakov494 4 ปีที่แล้ว

    Are you russian person?

    • @НурланБайбатыров-ю5м
      @НурланБайбатыров-ю5м 3 ปีที่แล้ว

      Я не знаю можно ли размещать ссылки на канал в комментариях. поэтому просто посоветую набрать Олег Молчанов в поиске и найдешь его русскоязычный канал

    • @bahakulbarakov494
      @bahakulbarakov494 3 ปีที่แล้ว

      @@НурланБайбатыров-ю5м да ладно это он? XDDDDD

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 ปีที่แล้ว

      yep, it's him

  • @lukaszromanowski8285
    @lukaszromanowski8285 3 ปีที่แล้ว

    thanx

  • @naeemnawaz4590
    @naeemnawaz4590 3 ปีที่แล้ว

    o please anyone help

  • @FunnyShorts_Trending
    @FunnyShorts_Trending 2 ปีที่แล้ว

    thank you very much

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 ปีที่แล้ว

      Thanks for watching, and for the comment!