This is really great stuff, Thank you! For WebSocket updates instead of sending the updates from the python code from the jupyter notebook, if you had used Django itself, that would have been more practical from Django point of view. Please make a tutorial on Django view updates that will trigger channels to send the data. Again thank you so much for all your efforts. Learning a lot from you :)
The idea of using notebook is to represent the behaviour of any edge device which is generating data and sending it to the server and the user is getting updates in the ui.
@@technologyfornoobs In this case, if an edge device is generating data then saving the data in DB and all will be done in consumer's receive method? if yes then ORM and all are synchronous how would we do that? using sync_to_async? Also a suggestion, instead of data generated from another source, Django view itself does the thing (for example, if the user had put some large file for processing and showing the progress of it in the progress bar, a real-time notification, etc) will be more practical in terms of Django.
1st, yes receive method is the place to save or manipulate data, and as we have already inherited AsyncWebsocketConsumer in our class we do not need sync_to_async, just async and perform usual actions. I am not much familiar with other frameworks async functionality, but in regular views, you still need to give a response at the end, and if the task is not completed like file upload, how it will reach to consumer.py I am not sure. I have read people using celery for the same task, need to explore more though.
Hello there. So I used everything I learned to make an APP of my own design here and wanted to deploy it to heroku, but i can't make it work. First because at deploying I encounter many errors, one of them is that twisted is not supported in heroku and is necessary for channels to run. Would you prepare a tutorial about deploying a real-time project like the one in the video? Or could you point me out if I would have to use Heroku Redis and maybe other kind of code for deployment. Thank you very much sir
I have not actually done it before, real time app deployment, but I assume you would have already followed the link blog.heroku.com/in_deep_with_django_channels_the_future_of_real_time_apps_in_django
The Websocket disconnects automatically after around 30-40 seconds, I'm sending the data through a scraper which takes about a minute to send. Where can I configure the timeout settings in django channels?
are you not subscribing to the socket before sending it, even if it is for long duration, you can re subscribe as your websocket url will be same right?
Very helpful content, but I need to display real time data on my website, the scraping python program is ready, could you please help me by explaining how should I link these programs or is there a different method altogether for this?
scrapping could be a separate program as it has to continuously run and keep updating the data. then you can use websockets to send the data to your app.
Hi there, Tahnk you for the tutorial, really really helpful. I am currently having an issue in the websocket part inside the jupyter notebook. When i try to run the second line i get the error message: --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in 1 import websocket,json,random ----> 2 ws = websocket.WebSocket() TypeError: __init__() missing 3 required positional arguments: 'environ', 'socket', and 'rfile' I tried to search google for an answer, but haven`t found one. In websocket documentation they say it should run normally. Any idea on how to solve this? Thanks again.
@@technologyfornoobs Yes, that was the problem. I had only installed websocket. I am now facing another problem which is "aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN'". Might be some problem in windows not supporting redis oficially. Should I try and install another version of redis? Thanks
@@technologyfornoobs Hello sir, I did it through the link shown in video (github/servicestack/redis-windows) and executed the redis-server.exe file. It still gives me the error. "aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN'". HTTP GET / 200 [0.31, 127.0.0.1:59219] Not Found: /favicon.ico HTTP GET /favicon.ico 404 [0.32, 127.0.0.1:59219] WebSocket HANDSHAKING /ws/tableData [127.0.0.1:59579] WebSocket CONNECT /ws/tableData [127.0.0.1:59579] Exception inside application: ERR unknown command 'BZPOPMIN' Traceback (most recent call last): File "C:\DEV ealtime\lib\site-packages\channels\sessions.py", line 183, in __call__ return await self.inner(receive, self.send) File "C:\DEV ealtime\lib\site-packages\channels\middleware.py", line 41, in coroutine_call await inner_instance(receive, send) File "C:\DEV ealtime\lib\site-packages\channels\consumer.py", line 58, in __call__ await await_many_dispatch( File "C:\DEV ealtime\lib\site-packages\channels\utils.py", line 58, in await_many_dispatch await task File "C:\DEV ealtime\lib\site-packages\channels\utils.py", line 50, in await_many_dispatch result = task.result() File "C:\DEV ealtime\lib\site-packages\channels_redis\core.py", line 452, in receive message_channel, message = await self.receive_single( File "C:\DEV ealtime\lib\site-packages\channels_redis\core.py", line 507, in receive_single content = await self._brpop_with_clean( File "C:\DEV ealtime\lib\site-packages\channels_redis\core.py", line 345, in _brpop_with_clean result = await connection.bzpopmin(channel, timeout=timeout) aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN' WebSocket DISCONNECT /ws/tableData [127.0.0.1:59579] Could not find help about this on stackoverflow and google. Do you have any ideia what that is?
Ok, there is another github which contains another version of redis: github.com/tporadowski/redis/releases For anyone having the same issue. That might be helpful. It is working fine
to my knowledge which is limited, people use some other tools in conjunction with Django, mostly with the help of Nginx. like hosting files logic. Not sure about the library webrtc in this context
you need to re-evaluate it, if you are making rest calls, then you need to push the data to the server and all the websockets still holds true, the rest call has to be served in a scheduled manner or somewhere outside of your app
Amazing Tutorial. I followed both. And I was able to run them! I have a question, It is possible to run the two "channels" in parallel? I mean: Have the table refreshing and having the graph (showed in the previous tutorial) working in the same page, how can I achieve that?
Thanks man , awesome stuff . I have been following you and implemented some of ur code / training in my app. I am stuck in one of the operation that am doing in Django . Need your help ,would be great if you can give me your email id i can share my app video and the exact problem .
Thanks for Amazing Tutorial. I've seen both videos and code also working......
Great to hear!
This is really great stuff, Thank you!
For WebSocket updates instead of sending the updates from the python code from the jupyter notebook, if you had used Django itself, that would have been more practical from Django point of view. Please make a tutorial on Django view updates that will trigger channels to send the data.
Again thank you so much for all your efforts. Learning a lot from you :)
The idea of using notebook is to represent the behaviour of any edge device which is generating data and sending it to the server and the user is getting updates in the ui.
@@technologyfornoobs
In this case, if an edge device is generating data then saving the data in DB and all will be done in consumer's receive method? if yes then ORM and all are synchronous how would we do that? using sync_to_async?
Also a suggestion, instead of data generated from another source, Django view itself does the thing (for example, if the user had put some large file for processing and showing the progress of it in the progress bar, a real-time notification, etc) will be more practical in terms of Django.
1st, yes receive method is the place to save or manipulate data, and as we have already inherited AsyncWebsocketConsumer in our class we do not need sync_to_async, just async and perform usual actions.
I am not much familiar with other frameworks async functionality, but in regular views, you still need to give a response at the end, and if the task is not completed like file upload, how it will reach to consumer.py I am not sure.
I have read people using celery for the same task, need to explore more though.
@@technologyfornoobs Okay thank you 😊
23:30, the subscriber is not able to connect, async def queue_factory() -> asyncio.Queue[str]:
TypeError: 'type' object is not subscriptable
not sure about this error, you are in same env as in the video or diff python version
@@technologyfornoobs I couldn't find a way to get your environment "py36", could you please share it?
Get the req.txt file from github.com/sharmasw/realTime-Tables-with-Django-Channels
create env
install it in "pip install -r req.txt"
activate env
@@technologyfornoobs Thank you so much!!
Great tutorial bro.thanks for awesome contents
Glad you like them!
its gonna be legen wait for it ...
Thanks!
Great tutorial Sir ♥️
Thanks 🙂
Hello there.
So I used everything I learned to make an APP of my own design here and wanted to deploy it to heroku, but i can't make it work. First because at deploying I encounter many errors, one of them is that twisted is not supported in heroku and is necessary for channels to run. Would you prepare a tutorial about deploying a real-time project like the one in the video?
Or could you point me out if I would have to use Heroku Redis and maybe other kind of code for deployment.
Thank you very much sir
I have not actually done it before, real time app deployment, but I assume you would have already followed the link blog.heroku.com/in_deep_with_django_channels_the_future_of_real_time_apps_in_django
@@technologyfornoobs Yes I did. Unfortunately got stuck on the handshake when openning the WSS. Trying to figure it out :0
well done sir, can we use channels to detect change in database? if so, please make the tutorial, thank you.
detecting change in DB you need to write logic in DB itself, using triggers. my guess for the solution.
The Websocket disconnects automatically after around 30-40 seconds, I'm sending the data through a scraper which takes about a minute to send. Where can I configure the timeout settings in django channels?
are you not subscribing to the socket before sending it, even if it is for long duration, you can re subscribe as your websocket url will be same right?
hii ,do you have any tutorial of making charts dynamic in django???
Not yet, but I have done it in past, it's lot of if else, and mostly on javascript
Very helpful content, but I need to display real time data on my website, the scraping python program is ready, could you please help me by explaining how should I link these programs or is there a different method altogether for this?
scrapping could be a separate program as it has to continuously run and keep updating the data. then you can use websockets to send the data to your app.
@@technologyfornoobs Okay, thank you so much!
Can you get the data instead from your models and use celery to continuously run a task?
I will try to work on it, Not sure now.
Hi there,
Tahnk you for the tutorial, really really helpful. I am currently having an issue in the websocket part inside the jupyter notebook. When i try to run the second line i get the error message:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in
1 import websocket,json,random
----> 2 ws = websocket.WebSocket()
TypeError: __init__() missing 3 required positional arguments: 'environ', 'socket', and 'rfile'
I tried to search google for an answer, but haven`t found one. In websocket documentation they say it should run normally. Any idea on how to solve this? Thanks again.
please install websocket-client and try again
@@technologyfornoobs Yes, that was the problem. I had only installed websocket.
I am now facing another problem which is "aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN'".
Might be some problem in windows not supporting redis oficially. Should I try and install another version of redis?
Thanks
Hi could you please download the zip file from the github and try the redis, that would solve your problem
@@technologyfornoobs Hello sir,
I did it through the link shown in video (github/servicestack/redis-windows) and executed the redis-server.exe file. It still gives me the error. "aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN'".
HTTP GET / 200 [0.31, 127.0.0.1:59219]
Not Found: /favicon.ico
HTTP GET /favicon.ico 404 [0.32, 127.0.0.1:59219]
WebSocket HANDSHAKING /ws/tableData [127.0.0.1:59579]
WebSocket CONNECT /ws/tableData [127.0.0.1:59579]
Exception inside application: ERR unknown command 'BZPOPMIN'
Traceback (most recent call last):
File "C:\DEV
ealtime\lib\site-packages\channels\sessions.py", line 183, in __call__
return await self.inner(receive, self.send)
File "C:\DEV
ealtime\lib\site-packages\channels\middleware.py", line 41, in coroutine_call
await inner_instance(receive, send)
File "C:\DEV
ealtime\lib\site-packages\channels\consumer.py", line 58, in __call__
await await_many_dispatch(
File "C:\DEV
ealtime\lib\site-packages\channels\utils.py", line 58, in await_many_dispatch
await task
File "C:\DEV
ealtime\lib\site-packages\channels\utils.py", line 50, in await_many_dispatch
result = task.result()
File "C:\DEV
ealtime\lib\site-packages\channels_redis\core.py", line 452, in receive
message_channel, message = await self.receive_single(
File "C:\DEV
ealtime\lib\site-packages\channels_redis\core.py", line 507, in receive_single
content = await self._brpop_with_clean(
File "C:\DEV
ealtime\lib\site-packages\channels_redis\core.py", line 345, in _brpop_with_clean
result = await connection.bzpopmin(channel, timeout=timeout)
aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN'
WebSocket DISCONNECT /ws/tableData [127.0.0.1:59579]
Could not find help about this on stackoverflow and google. Do you have any ideia what that is?
Ok, there is another github which contains another version of redis: github.com/tporadowski/redis/releases
For anyone having the same issue. That might be helpful. It is working fine
thank you very much !! helped me a lot
Glad it helped!
Great video. One doubt. Can django channels be used for video streaming between browsers using webrtc?
to my knowledge which is limited, people use some other tools in conjunction with Django, mostly with the help of Nginx. like hosting files logic. Not sure about the library webrtc in this context
@@technologyfornoobs ok thanks
@@technologyfornoobs Can we make a video calling app with django channels?
@@harshitsantosh825 absolutely
when we are using async, how can we update the database?
at receive part of the consumer.py.
@@technologyfornoobs it would be great if you could show an example in future tutorial.
will update!
Iam receiving data from api in views and prints to terminal works fine. I just want to send data from views to template real time
you need to re-evaluate it, if you are making rest calls, then you need to push the data to the server and all the websockets still holds true, the rest call has to be served in a scheduled manner or somewhere outside of your app
Amazing Tutorial. I followed both. And I was able to run them!
I have a question, It is possible to run the two "channels" in parallel?
I mean: Have the table refreshing and having the graph (showed in the previous tutorial) working in the same page, how can I achieve that?
Yes, absolutely,you need to pass the channel name dynamically,like we do it in URL patterns.
I guess your virtualenv isn't working right. If you look at the req.txt file then you will know :/
yeah he is probably not using virtual env
thx
so much
Thanks!
Can you set up video calling/chat using Django Channels and WebRTC? Please do a video about that, I'm sure everyone would want to know how to do that
yes sure, but doing it through python/Django won't be good for production purpose as its not matured yet.
@@technologyfornoobs I want to see how video calling/chat works in Django too. Please do that video ! Thanks for the amazing tutorial
Best.Thank you
Thank you too!
Please sir, can you make video on django + channels + socket in Hindi
ua-cam.com/video/32iJlPDNLQY/v-deo.html
This one has what you want!
python -m pip install -U channels["daphne"]
awesome
Yo!
Sir please create an real state ml react dj web ...
sure, will work on it in some time.
Thanks man , awesome stuff . I have been following you and implemented some of ur code / training in my app. I am stuck in one of the operation that am doing in Django . Need your help ,would be great if you can give me your email id i can share my app video and the exact problem .
Also , keen to know if you would love to work on consultancy basis / project basis with us . Thanks!
Techfornoobs01@gmail.com
@@technologyfornoobs I have emailed you , please check .