DJANGO CHANNELS || Django Real-Time Application || Tutorial 2020 || WebSockets Async

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

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

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

    can we just take a moment to appreciate the fact that this guys still responds to queries 8 months after upload

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

      i guess Im randomly asking but does anybody know of a tool to log back into an instagram account?
      I was dumb forgot my password. I would love any help you can give me!

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

      Thanks!

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

      you can use password reset.

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

    this is one of the best tutorials, fast and in structure explaining

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

    Thanks for making good content. For the people following along the notebook is referring to websocket-client package. Also the use ws = websocket.create_connection('ws://localhost:8000/ws/polData/') to connect from ipnyb. Also I would recommend author to use requirements.txt files to using pip freeze to make it easier for people to follow the course

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

    I actually now understand the django channels. Thank you!

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

    This is truly the tutorial of all time

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

    Don't underestimate the coding of small creators👍👍❤️❤️

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

    Worthy video for getting started with web sockets. Thanks bro

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

    I have now got a good understanding how django channels work. Thank you for the perfect content. Please can you make a video about how to use it to fetch data from database. Much love🥰❤❤❤

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

    Thanks for the tutorial. How would this solution works when scaling up (horizontal scaling - multiple instance of the server) ?.

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

      I would not recommend this approach then.

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

      @@technologyfornoobs Any recommendations for scaling?

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

      @@dnj86 Scaling is a different beast, what I did was a PoC where people with few resources or a single resource are just trying to get something in action. to showcase, if a scalale solution needs to be built, another tech stack needs to be introduced. Not just python In my opinion.

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

    Apparently for python versions greater than 3.6 they recommend adding .as_asgi to the url routing.
    websocket_urlPattern=[
    path('ws/polData/',consumer.DashConsumer.as_asgi()),
    ]
    using the adjustment to the url and the following in the client code I was able to establish a connection
    ws = websocket.WebSocket(sslopt={"check_hostname": False})
    ws.connect("ws://localhost:8000/ws/polData/")
    Thanks
    John

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

      yes now Django provide wsgi.py and asgi.py when we create project.

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

    Very nice tutorial. thanks for sharing.

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

    Thanks for this amazing tutorial and example code

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

    Best tutorial i've watched

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

    omg such an amazing content. loved it ❤❤

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

    Great explanation. But how are you creating the messages which is shown in 28:42 ?

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

      The error message? It's default from the server

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

      @@technologyfornoobs - no, how are sending messages through websocket-client

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

      websocket client is a library which provides api to communicate with websockets, more detailed info github.com/websocket-client/websocket-client

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

      @@technologyfornoobs thanks

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

    Very nice tutorial. I am facing a problem of ws=websocket.WebSocket().It is throwing an error of -__init__() missing 3 required positional arguments: 'environ', 'socket', and 'rfile'

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

      there are 2 libraries websocket-client==0.57.0, websockets==8.1, the one in notebook is client one.

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

      I am facing the same problem.

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

    Great Work. Worth watching if you want to learn and implement basic Web sockets in django

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

    Great tutorial! How can I send data from a server to a ML algorithm in Django that then process it and send the data to a real time graph? Any suggestion? Thanks!

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

      I think you might know the answer after going through the video.

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

    great video, nice way of showing on charts!

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

    Thank You, I've been understanding really well, but at 38:52, after trying to connect the subscriber to the server I get:
    in main
    async def queue_factory() -> asyncio.Queue[str]:
    TypeError: 'type' object is not subscriptable
    , please help!

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

      check the websocket library which you are using, the one in notebook is websocket-client

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

      @@technologyfornoobs Now after installing websocket-client it says:
      No module named websocket.__main__; 'websocket' is a package and cannot be directly executed

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

      see you are missing some points in video, you need both websocket-client and websockets

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

    Great work sir..

  • @muddymkamba352
    @muddymkamba352 6 หลายเดือนก่อน

    I want to deploy channels with apache any leads on how to configure apache2 to perfom this

    • @muddymkamba352
      @muddymkamba352 6 หลายเดือนก่อน

      I have tried with daphne and redis in development server is working fine but in apache I am getting error

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

    man.... this is a very cool tutorial, good job.

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

      Glad you liked it!

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

      @@technologyfornoobs If I will implement the system in IoT, some architectures involve broker (redis) and worker (celery), why is that?
      Here you show, the django channel can solve this problem.
      Then what about the role of the MQTT broker (mosquitto)? can redis replace it?
      Maybe you can help explain it.
      Regards

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

      @@doditsuprianto4304 I am not an expert in IoT infra kinds of stuff, yes Redis is still needed in our implementation as well for obvious reasons, and WebSockets is another protocol and MQTT is a diff protocol, where the data packet is even smaller than what we have done in WebSockets.

  • @fotinik.6664
    @fotinik.6664 2 ปีที่แล้ว

    Great Video! Can you identify the versions of the libraries you use?

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

    Great tutorial.
    I have a use case of creating a real time dashboard by fetching continuous data points from a websocket API exposed by a third party app.
    How do I establish a ws connection with that API using channels?

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

      you just need a javascript here, unless you want to save it somewhere. you consume that api in the ui and show the graph.

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

      @@technologyfornoobs I want the real time data points to be stored in the database as well. The architecture I thought of is similar to what you have demonstrated here.
      Is there a way to run the process of Jupyter notebook in the Django app itself, as a continuous background task or something?

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

    just amazing !! beautifully explained !!

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

    awesome tutorial ...i request you to make tutorial on how many users click the link, their ip address,i mean tracking their activities in graph from in backend side of blog website?

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

    Actually i am making web app for my final year project. can you tell me how can i open socket for each edge device, like in my project there will be edge device for each individual client and graph should only be plot for client who logged in into the system.

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

      I would recommend you to go through the concepts again, may be you already know the answer, and also the video is quite old now, many things have change and many other technologies are available to do such things.

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

      @@technologyfornoobs i just want token authentication for user authentication.Each edge device have unique token so that data sending from user edge device must display on their own homepage. if you have discord then we can chat there.

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

      oh i got it i have to open channel for individual user.

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

    Thank you very much awesome tutorial very useful and complete. If I want to send 6 different values what can I do?

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

      Yes you can, in my video I kept the channel value as constant, you can also pass channel value as dynamic and accordingly websocket will send data and our server will update based on the channel the data belongs.

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

    Awesome video.
    Please make a series on django channels

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

    Great Content but how did you connect the websocket server from jupyter notebook since i keep getting this error:
    ws=websocket.WebSocket()
    TypeError: __init__() missing 3 required positional arguments: 'environ', 'socket', and 'rfile'

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

      there are 2 libraries websocket-client==0.57.0, websockets==8.1, the one in notebook is client one.

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

      @@technologyfornoobs Thanks for getting back to me and for your help. Really appreciate. Do you have an email address I can message you on?

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

      @@mayurg2661 techfornoobs01@gmail.com

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

      @@technologyfornoobs sent you an email

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

    looking a django project which will store the console output to a txt file and same thing need to be displayed on the UI page as well

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

      Could be a good exercise, don't look for it, you may already know now how to implement it.

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

    If you're on Windows and you have problems installing channels with an error like: Microsoft Visual C++ 14 is required, Download Twisted from www.lfd.uci.edu/~gohlke/pythonlibs/#twisted. Choose the win32 one corresponding to your python version. For instance, I used Python 3.8; so I downloaded Twisted‑20.3.0‑cp38‑cp38‑win32.whl (Notice "cp38"). Once downloaded, navigate to the download folder in your command prompt and run 'pip install ' followed by the file u just downloaded. After this you can install channels or whatever. You're welcome!

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

      Nice tip!

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

      Pip install pipwin
      Pipwin install twisted
      This is super trick if any pkg getting error in installing..

  • @DD-be9gb
    @DD-be9gb 3 ปีที่แล้ว

    Great video bro! Thanks

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

    Dude totally underrated video. You did such a great job of explaining the theory and implementation of this thank you. I am definitely subscribing and will be eagerly waiting for new videos. Btw as a windows user I ran into a few issues. Below are the solutions that helped:
    Issue 1: When installing channels (pip install channels) I kept getting an error when it attempted to install Twisted
    Solution: Use Python 3.7 instead of 3.8, twisted is not supported on 3.8
    Issue 2: aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN', this happens because redis is not supported on windows
    Solution: Install the Ubuntu 20 app in the windows store and activate the WSL. When you run the app update+upgrade your repos (sudo apt update; sudo apt upgrade -y) then install redis-server and redis-cli (sudo apt install redis-server -y; sudo apt install redis-cli -y) this should install redis version 5. type the command, redis-server to start redis then you shouldnt be good to run django and publish data.
    I hope this helps.

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

      Great!

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

      Hey man , I had this twisted problem before , for python 3.8 u need to download twisted urself for python 3.8 and then install it locally with pip in your project ,at least that's what I did , I'd like to know if u came up with a better solution.
      and for the redis you could use docker it's very easy u just start a redis server. good luck :)
      I hope this helps a little

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

      @@ashkanoliaie6548 I've tried many solutions like using WSL 2, installing an older version of redis and using docker on my windows machine to use redis and have not been able to shake the BZPOPMIN error. I've gotten the redis server running in a bunch of different ways but am yet to successfully connect. Does anyone have an explicit basic step-by-step solution on how to run and connect to a redis server in windows? I'm sure I'm missing something simple, docker seems to be easy enough but I just keep getting this error. Thanks in advance

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

    clear cut explanation! Awesome

  • @ThiagoAraujo-hh6xu
    @ThiagoAraujo-hh6xu 4 ปีที่แล้ว

    I am getting an error on the ws=websocket.WebSocket. Follow the error msg: "TypeError: __init__() missing 3 required positional arguments: 'environ', 'socket', and 'rfile'". Any idea what is wrong?

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

      please check the python and websocket version you are using, you can match it with requirement.txt file in the git.

    • @ThiagoAraujo-hh6xu
      @ThiagoAraujo-hh6xu 4 ปีที่แล้ว +1

      @@technologyfornoobs I found the issue. I installed websocket instead of websocket-client. Thanks for answering. Then later in the video, I also had to install websocket. It would be easier if I had follow your requirements.txt. I also had problems with the newer version of channels_redis(as I am on windows). Then I had to specify the correct channels_redis version to install. Now it is working.

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

    Great explanation.🔥🔥🔥🔥🔥🔥🔥

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

    Thanks! perfect tutorial

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

    Great content, thanks for simplifying it. Do you deal with websocket addresses when you port the django app to google cloud?

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

      i guess it would as in normal deploy scenario, noting needs to be changes, just care for the allow domain option.

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

      @@technologyfornoobs Thanks for the reply. I was able to upload it to cloud. The roadblock was that Google App Engine doesn't support websockets, so I ended up using Google Compute Engine. I have a follow up questions. If you have multiple windows on a page all streaming, how do you extend the code?

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

      do you mean multiple graphs? or just browser windows?, if multiple graphs, just make an addition in the consumer.py where I have fixed the channel name make it dynamic by sending it as a url parameter and do the required changes in the respective codes.

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

      @@technologyfornoobs Multiple Graphs

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

      I looked into consumer.py as you mentioned and created two classes and routed each websocket to different class. It has worked! Thanks for the suggestion.

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

    Hi , i need to do a time series analysis of stock data. Where as i have to show live data graph on frontend ? How can u perform using lstm algorithm to show data and prediction on ui in django?

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

      that could be simple and could be complicated.what's your input structure for LSTM would define the complication in approach, as in real time you will get a single data point, and LSTM would need some window of data to process and predict. but just a clue in Consumer.py file >> receive part you would have the logic to predict.

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

      Or you score it outside and send as another data point for dashboard, no need to include it in Django app.

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

      @@technologyfornoobs thankyou for solution . I appreciate. Can you please tell me more about it. Like how can i exactly use realtime time series analysis of stock data. As of now i only have data in csv where as i could use the same in db and fetch in dashboard but when it comes to real time analysis, it really become hard.

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

      @@storememory I think you need something more robust that this. There are dedicated tools for this problem e.g time series databases like KDB. if you want to have a crude implementation think about using a redis solution with a siding window and performing the calculation there using a pub sub mechanism. UI framework like django and channels are really not the place where business logic and critical processing should happen

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

      @@storememory Hey Nishant, have you completed your analysis of stock data work? I just wanted a little help.

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

    Can we authentic the request that which user is sending the request

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

    Thanks bro...!! Can you make a video regarding deploying this project on production server.

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

    Why we need consumer if we can directly pass data from websocket into js

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

      we need consumer for creating the webserver which can publish the data real-time to other consumers if you already have a WebSocket somewhere else you do not need Django component

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

    I have little confusion about it that We can can send data from client(publisher) to server without redis,then why we have use redis server here? I run this code without redis but I see that it can perfectly send data to server.
    Hopefully you will reply and help me to know about it.
    Thanks

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

      We have defined the redis server config in settings if you notice, redis helps on this communication. Django also provides a default server for websocket but it's not recommended to use. Just another point, server is using the redis not client

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

    Can we integrate a tensorflow python chatbot in a django website using this?

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

      that could be a good project, let me check.

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

      @@technologyfornoobs sure.thank you for the help!

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

    consumer.DashConsumer.as_asgi() When I add .as_asgi(), my code worked at routing.py. Why? Thanks for your sharing.

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

    Excelente video you have a new subscriber!

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

    Cool, I understand, but I don't understand why use group in costumer please make more videos about this. Thanks God bless you 👍

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

    Setting up Django environment is a real challenge, several package dependencies. Though there is online support and forums to help but it is gets outdated within dates with new updated packages.

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

      that's why it is important to work in a separate environment.

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

      @@technologyfornoobs Can you please provide answers to previous questions below?

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

    amazing tutorial

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

    How do I get an analog sensor's data values?

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

      Where is your sensor connected, depends on that, if raspberry pi then all sensor has some module which can help you on sending the data.

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

      @@technologyfornoobs My sensor is connected to ESP8266 NodeMCU.

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

      is there a way to make rest calls in this device?

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

    ----> 1 ws=websocket.WebSocket()
    TypeError: __init__() missing 3 required positional arguments: 'environ', 'socket', and 'rfile' got this error and i didnt find the requirements.txt in the git

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

      i m using django 3..there is already asgi.py..TypeError: object.__init__() takes exactly one argument (the instance to initialize)
      WebSocket DISCONNECT /ws/polData/ [127.0.0.1:57510]

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

      Yes, you are using latest Django which gets you asgi.py file created.
      And I somehow do not have req.txt file missing in mostly all repositories, not sure why,
      But for now the error you have is not in django, but in Notebook I am assuming, and the solution for this is you need to install "websocket-client" not the "websocket" only.
      Try this

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

      @@sambitsahoo8071 I am getting the same error!

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

      @@technologyfornoobs The error is on the CLI. Not in the notebook.

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

    I am seeing this problem, can you help resolve it.
    AttributeError: module 'websocket' has no attribute 'create_connection'

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

      you need to install "websocket client", "websocket" is a separate module.

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

      @@technologyfornoobs I am seeing another error now.
      File "test.py", line 8, in
      ws = websocket.create_connection('ws://localhost:8080/ws/polData/')
      File "/home/adtran/.local/lib/python3.8/site-packages/websocket/_core.py", line 592, in create_connection
      websock.connect(url, **options)
      File "/home/adtran/.local/lib/python3.8/site-packages/websocket/_core.py", line 248, in connect
      self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options),
      File "/home/adtran/.local/lib/python3.8/site-packages/websocket/_http.py", line 120, in connect
      sock = _open_socket(addrinfo_list, options.sockopt, options.timeout)
      File "/home/adtran/.local/lib/python3.8/site-packages/websocket/_http.py", line 200, in _open_socket
      raise err
      File "/home/adtran/.local/lib/python3.8/site-packages/websocket/_http.py", line 175, in _open_socket
      sock.connect(address)
      ConnectionRefusedError: [Errno 111] Connection refused

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

      @@technologyfornoobs Using IP of the server in connect request gives a different error.
      websocket.create_connection('ws://x.4.95.208:8080/ws/polData/')
      Traceback (most recent call last):
      File "", line 1, in
      File "/home/adtran/.local/lib/python3.8/site-packages/websocket/_core.py", line 592, in create_connection
      websock.connect(url, **options)
      File "/home/adtran/.local/lib/python3.8/site-packages/websocket/_core.py", line 252, in connect
      self.handshake_response = handshake(self.sock, *addrs, **options)
      File "/home/adtran/.local/lib/python3.8/site-packages/websocket/_handshake.py", line 79, in handshake
      status, resp = _get_resp_headers(sock)
      File "/home/adtran/.local/lib/python3.8/site-packages/websocket/_handshake.py", line 164, in _get_resp_headers
      raise WebSocketBadStatusException("Handshake status %d %s", status, status_message, resp_headers)
      websocket._exceptions.WebSocketBadStatusException: Handshake status 500 Internal server error
      ###########################
      Error on Django Server:
      Exception inside application: No application configured for scope type 'websocket'
      Traceback (most recent call last):
      File "/usr/local/lib/python3.8/dist-packages/channels/routing.py", line 73, in __call__
      raise ValueError(
      ValueError: No application configured for scope type 'websocket'
      WebSocket DISCONNECT /ws/polData/ [x.4.95.208:43598]

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

      @@technologyfornoobs Can you please help provide answers for below questions?

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

      Hello, you need to have both websocket and websocket client in your env, websocket is used in django side, websocket-client is used in notebook to communicate as a 3rd party tool or device.

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

    where can i add an url if I am calling through an api?

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

      Any where in apps url or in project urls or in ASGi urls

  • @Mukeshkumar-yl1qq
    @Mukeshkumar-yl1qq 2 ปีที่แล้ว

    Thank you so much

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

    what are you doing in 29:23 ?

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

      trying to communicate to the app using a simulated env, i.e notebook in this case.

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

    many thanks to you sir

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

    Please tell how to use channels in production. I'm having an error

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

      I need to check about this, will update you, have you checked if Gunicorn supports ASGI?

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

    Awesome :D Thank you !

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

    such an amazing content, how can I connect this with angular service worker

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

      instead of using the django templates for UI, we need to just use it as a API.

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

    Thank you Brother
    ❤❤❤❤❤❤❤❤❤❤

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

    Thanks, sir for this amazing tutorial. I have a requirement where instead of a dashboard, there will be a table. And data in that table should update automatically when new data is added in DB and that is without refreshing the page. Can we use Channel in that case?

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

      Yes, correct, there is a another video where I am updating the table real time
      check for it.

  • @TrungNguyen-ty9fc
    @TrungNguyen-ty9fc 4 ปีที่แล้ว

    Great tutorial! When I tried to do Websockers connect, I got this error:
    ...
    WebSocket HANDSHAKING /ws/polData/ [127.0.0.1:64222]
    WebSocket CONNECT /ws/polData/ [127.0.0.1:64222]
    Exception inside application: ERR unknown command 'BZPOPMIN'
    ...
    aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN'
    WebSocket DISCONNECT /ws/polData/ [127.0.0.1:64222]
    Any idea to address the error?

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

      Can you check your redis version, also try the default django channel server instead of redis, that might solve the problem for now.

    • @TrungNguyen-ty9fc
      @TrungNguyen-ty9fc 4 ปีที่แล้ว

      @@technologyfornoobs For solution, I installed Memurai as advised in stackoverflow.com/questions/62786988/redis-err-unknown-command-bzpopmin

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

    thank you🌹

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

    Great work brother It solved major portion of my problem and helped me to design my code flow.
    But i am confused about channel layer, and redis.
    Do we have to run redis on another server in production??
    And can you please make a video or deployment?

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

      not in another server at the same server, and defied it in the settings.

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

      @@technologyfornoobs can i contact you on whatsapp or your email if you dont mind??

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

      Ping me at Techfornoobs01@gmail.com

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

      @@technologyfornoobs Hey hope you're doing good,
      do you know any free resoucre where i can deploy my django-channels applicaiton free/without credit card

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

      I guess no, credit card is mandatory step in any service now a days.

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

    Awesome !!!!

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

    can u make tutorial Django Rest Framework. OAuth, JWT, Sessions, cookies, etc. Security related concepts in Django.

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

    Nice tutorial..!!
    Can you please explain how we can integrate celery with this project.
    As I am new to django I dont know how to do it.
    Specifically , what if I want to request some api for data which is sending to receive in websocket instead of running stand alone script in notebook???
    it will be great for me if you suggest.
    Thank you.

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

      I hope you have gone through this link for celery with django:
      docs.celeryproject.org/en/stable/django/first-steps-with-django.html
      You are asking, to call an rest API and then send the response to the websocket and proceed on >>> it is possible, but what would be your logic to call the rest, as websocket works on a concept of event, if event happens then all things initiated,
      So even in my application in the notebook I created a client which was subscribed to my websocket service and event happened and all process started. In your case you also have to write some client whether it is calling a rest or any data event by any device, but at the end it must be subscribed and push the data to your websocket service.

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

      @@technologyfornoobs Thank you for quick reply..
      I have read celery doc and implemented it. Problem I am facing is how can I push data from my task function within same project. Means as in your notebook app we first define websocket and send data with "ws.send(URL)" method. Should I use this way to push data in same project or is there any other method to do that. Sorry for my lack of knowledge.
      But I want to learn.

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

    please do complete tutorail on django rest framework

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

    great video!

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

    please make projects on Shipping management system in django

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

    how to do this in MQTT?

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

      Some work are already done , I guess you should be able to find it.

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

    How Have you created this web socket client to send data to the server

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

      using a package websockets in python

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

      @@technologyfornoobs at 28:52 from where are you sending data to the routing port. Cause i am receiving error, "no connection made, because target machine actively refused it." which website are you using to generate client side data? How can i generate the same on my system itself? please elaborate

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

      @@yashmathur1389 have you started the django server and redis server?

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

      @@technologyfornoobsyou are using redis server or the default server django provides

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

      i am not using redis server and default server is on

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

    How to create 2nd page after login and to display Images ..

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

      To display images in such a way that..it should display person who added name and no of times others downloaded

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

      You have to maintain a database to show the records,and with the action in button click add a value to the number of download counts

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

      @@technologyfornoobs Please show that in your channel
      ..

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

    Can you make chatting appliaction on web with this?please

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

      Thats the default app which people create using websockets and channels. Its in the Channels documentation as well.

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

      @@technologyfornoobs Ya But I think it is real-time and I want to store the message so that whenever anyone loads the page all the message will be there forever

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

      the moment you get the message in your websocket server, you can add the logic to add it in database.

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

    Thank You sir

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

    Thank you !

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

    Thank you for the video. I am trying to develop a django dashboard for sensor data so it is really in line with what I am trying to do.
    I am getting an error with the Jupyter code. I have installed websocket-client and uninstalled websocket and websockets.
    The first error I get is
    ws=websocket.WebSocketApp()
    TypeError: __init__() missing 1 required positional argument: 'url'
    If I put the url in ws=websocket.WebSocketApp('ws://localhost:8000/ws/polData/')
    The following error comes up.
    ws.connect('ws://localhost:8000/ws/polData/')
    AttributeError: 'WebSocketApp' object has no attribute 'connect'
    No Handshake occurs
    Thoughts appreciated.

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

      You dont need to uninstall the websocket and websockets. as they are needed for Django App

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

      @@technologyfornoobs Thank you - it is working now.

  • @SURJEETSINGH-ms9iu
    @SURJEETSINGH-ms9iu 4 ปีที่แล้ว

    niceeyyy

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

    bro could you make a recommendation system using tensorflow and integrate the model in a e - commerace type web application of django. please bro... by the ways loved your videos

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

      yes, its possible, its just the stack would be different and video would be long. :)

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

      @@technologyfornoobs i request you please make a video on that😍😍

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

      But recommendation using Neural network is itself a challenging task, mainly those are done using other algotithms

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

      @@technologyfornoobs bro.... Plz make a video of django integration with react js and any simple project on it....

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

    When i tried,it showed me connection lost,why it was!!!

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

      Please try to debug or at least give some error details

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

    🔥 🔥 🔥 Awesome Tutorial
    Can we stream serial data or output through websockets ?

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

      I think it's possible, but need to be tried first, but I guess its possible sending a bit at a time.

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

    Django 3.1??

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

      2.2.3 but would work on 3 as well

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

      works with 3.1, I tried this with 3.1 and definitely works, see my other comment for very minor change you might have to make. Another minor change might be required to use the same with Daphne where you need to get the 'default' application and setup django instead of just the asgi application

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

    Jupyter code not working as error

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

      Not sure what issue you have, but may be if issue is at websocket line, then install websocket client

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

      @@technologyfornoobs I have sent email error

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

    do chat bot application using django without any frontend framework

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

      You mean using console?

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

      @@technologyfornoobs using js but not js framework(react,angular)

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

      The default example in Django Channels has the same chat project, its plain javascript

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

    Hi,
    I got this issue with websocket connection as it is getting closed due to handshake error , The error Message are as below:
    WebSocket HANDSHAKING /ws/polData/ [127.0.0.1:59304]
    Exception inside application: object.__init__() takes exactly one argument (the instance to initialize)
    Traceback (most recent call last):
    File "/usr/lib/python3.7/site-packages/channels/routing.py", line 71, in __call__
    return await application(scope, receive, send)
    File "/usr/lib/python3.7/site-packages/channels/sessions.py", line 47, in __call__
    return await self.inner(dict(scope, cookies=cookies), receive, send)
    File "/usr/lib/python3.7/site-packages/channels/sessions.py", line 172, in __call__
    return await self.inner(self.scope, receive, self.send)
    File "/usr/lib/python3.7/site-packages/channels/auth.py", line 181, in __call__
    return await super().__call__(scope, receive, send)
    File "/usr/lib/python3.7/site-packages/channels/middleware.py", line 26, in __call__
    return await self.inner(scope, receive, send)
    File "/usr/lib/python3.7/site-packages/channels/routing.py", line 160, in __call__
    send,
    File "/usr/local/lib/python3.7/dist-packages/asgiref/compatibility.py", line 33, in new_application
    instance = application(scope)
    File "/usr/lib/python3.7/site-packages/channels/generic/websocket.py", line 159, in __init__
    super().__init__(*args, **kwargs)
    TypeError: object.__init__() takes exactly one argument (the instance to initialize)
    WebSocket DISCONNECT /ws/polData/ [127.0.0.1:59304]\

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

      I think you have wrong version of redis installed

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

      @@technologyfornoobs also got this exact same issue, have the newest version of redis

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

      @@woutvandroogenbroeck8047 github.com/sharmasw/realTime-Tables-with-Django-Channels
      Use redis from this repo

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

    Awesome video mate. Do you have a twitter handle to follow?

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

    Pip install pipwin
    Pipwin install twisted
    This is super trick if any pkg getting error in installing..

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

    Why u not mention scope ?

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

      Consumers receive the connection’s scope when they are initialized, which contains a lot of the information you’d find on the request object in a Django view. It’s available as self.scope inside the consumer’s methods.

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

      @@technologyfornoobs how to check , second user disconnected or not.
      I think in websocket _ disconnect function we have to use , self.channels.group_send(
      Group_name,
      {
      Type:'leave.room', message:'leve room'}
      ) method , am right or not .

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

      yes some thing similar, by this logic you can also add how many user are in the chat room or if any user left the room kind of functionality, as the connection get closed by the user it does reach to disconnect functionality and as I haven't written anything so it does not do any thing.

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

    group add none type error beacause of channel layer
    github.com/django/channels/issues/1036
    it doesn't matter that you follow video

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

    can you please make a group chat like whatsap

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

      I can but don't you think it will be over killing and all people will just ping and so all those notorious things will happen like sharing irrelevant contents

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

      @@technologyfornoobs no bro i meant making a chatroom like app where users can create a room and others can join you can also give them the option to make public or private rooms that's what i have to for school but i already know about websockets and channels i just don't know how to create a database for the rooms and allow real time messaging in it

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

      @@mostnotoriouspinpin7581 the project you are talking about is the example given in django real time websocket documentation

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

      @@technologyfornoobs ok thanks man I'll take a look btw i sub

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

    Hey, really amazing content, I was searching for this only. I am working on my own data analysis backend and I have very similar requirement, but the source of data is different and I am stuck on that. I would like to get your insight on same. How can I contact you ? Hope you will reply

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

    My Suggestion: can you make telegram group for communicate better way.

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

      you can connect at techfornoobs01@gmail.com, will check about telegram.

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

    Hi
    It's a Nice Video.
    Is it require to have python code on third party sensors. or please let me know how to featch data from sensors to phyton programe .
    Appreciate if you help me and share your email Id.

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

      Not required in 3rd party sensor, you just need a measure to subscribe to the websocket to send data. might be using curl, c any thing

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

      @@technologyfornoobs Thank you
      Do you have any such video or referance document, Please

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

      @@Vilasppatil No videos as of now. Just search for the same stack which you are looking for apart from python

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

      @@technologyfornoobs Ok Thanks for reply.
      please let me know, if you can provide paid online coaching. My Email ID : vilasppatil@gmail.com

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

      You can reach me at techfornoobs01@gmail.com

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

    Amazing video. I needed some help with something. How can I contact you? Can I ask here?