at last !! someone did an example video, I've been waiting so long for this (I've read the docs, but i wanted to know if i am doing things wrong, always better to watch an expert do things to get a perspective than just wing it) thanks alot man , subbed and liked.
Very nice, well-organized, and informative video. I got huge help by watching your other videos on Django. Thanks a lot for this wonderful work and please keep it up!
For Django 4.x - You need to change @sync_to_async to @sync_to_async(thread_sensitive=False) before get_stories_async() and get_movies_async() functions. Huge thanks to @ssadxuyui5060 who first commented the solution over a year ago in a reply.
You should use `ab` to confirm that the async view would enable more requests to be handled as a effect of not blocking requests to execute while they wait for the io.
Hey Luke! This channel really deserve more and my suggestion would be give a tutorial on Brad Traversy's channel. People will definitely follow you here. Django 3.1 async views I was waiting for this tutorial and here we go... You never disappoint us. Keep up the good work Luke an never stop producing such a good tutorials. Many many thank you 🙏😊
Thank you Aashay. Regarding the views on my channel - I know they aren’t spectacular, but I’m very happy :) I honestly didn’t believe I’ll get 1000 subscribers. As it is for Brad Travesy channel I have to first improve my english :) thanks a milion times for the support!
When I define the post function in view as "async" like the async def main_view_async(), I keep getting this error: AssertionError: Expected a `Response`, `HttpResponse` or `HttpStreamingResponse` to be returned from the view, but received a `` What's the way around this?
@@Pyplane thank you very much, you as our teacher you should become the thanks ;), just one question please, can i work years with atthost without any problems i mean should i make a 5 year payment ?
hi great tutorial as usual. i was finding something else and found you again. for example if we have 1000 requests data to show in template. can we show data of each request whenever request data returns like request 1: loading request 2: success here is your data value request 3: success here is your data value request4: loading request5: fail etc and each request is on different api . feel like real app data. need it very badly any guide or help ?
@@danielaceros5723 Of course I do. My memory isn't perfect but I'll always remember the people who motivated me to carry on :) I am very happy and proud that you learned something from me :) Have a great day :) btw. nice Polish :))
@@Pyplane hi, i want hep regarding this. my view takes more than 6 seconds but timeout happens in 5 secinds. how do i send http response first and then do processing. in this example it waits in both cases. i dont want to wait. return response first and then do things. it is possible using async
I personaly don't work with ajax - the reason is that the code can get messy when building more advanced applications. For me a much better and easier way to do this is using django rest framework and react on the frontend. A tutorial on this will appear on the channel pretty soon. Cheers
Not really a good video. You doesn't explain very much, your toy example is too trivial to show something and also it just doesn't work as aspected. And yeah I saw the edited note about asyncio.sleep but if you can edit this you should have rather re-record this video. Cool that you make videos to show off new stuff but please more effort the net is full of broken toy examples like this. Personally I don't want that python becomes the next js in this regard.
at last !! someone did an example video, I've been waiting so long for this
(I've read the docs, but i wanted to know if i am doing things wrong, always better to watch an expert do things to get a perspective than just wing it)
thanks alot man , subbed and liked.
Thank you :) however if you want to see a real Django expert in action - check out Daniel Feldroy’s channel. I’m not an expert just a practicioner :)
True! Luke is ahead of everybody😀
@@Pyplane thanks for your humble recommendation will check it out
DEP009 is some exciting stuff, async enabled querysets will be coming soon
i'm just wondering what this will mean for the rest framework.
Just had a question, can't we use async views in Django rest framework? Because serialization and other things happen there right?
After Reading Documentation. I was confused. you did it very well. thanks from India...
Finally, I found it. 😍😍. Please keep going. Take love.
Hi Milon. Happy you're still here and very glad you liked the video. Cheers! :)
Very nice, well-organized, and informative video. I got huge help by watching your other videos on Django. Thanks a lot for this wonderful work and please keep it up!
For Django 4.x - You need to change @sync_to_async to @sync_to_async(thread_sensitive=False) before get_stories_async() and get_movies_async() functions.
Huge thanks to @ssadxuyui5060 who first commented the solution over a year ago in a reply.
that was it! thank u!
Thanks a lot man, I was really beginning to think I'm on the wrong side of a bad dream :)
Your tutorials are so good, I'm going to go through all of them :)
Was waiting for this. Great one
Hi James. Thanks. Happy you liked it :)
Finally async views. Great one 🔥
Thank you Pabor! :)
You should use `ab` to confirm that the async view would enable more requests to be handled as a effect of not blocking requests to execute while they wait for the io.
what does ab mean?
Many thanks Luke for @nother great video
Thanks for watching Naresh! :)
Great tutorial and thank you
Hey Luke! This channel really deserve more and my suggestion would be give a tutorial on Brad Traversy's channel. People will definitely follow you here.
Django 3.1 async views I was waiting for this tutorial and here we go... You never disappoint us.
Keep up the good work Luke an never stop producing such a good tutorials.
Many many thank you 🙏😊
Thank you Aashay. Regarding the views on my channel - I know they aren’t spectacular, but I’m very happy :) I honestly didn’t believe I’ll get 1000 subscribers. As it is for Brad Travesy channel I have to first improve my english :) thanks a milion times for the support!
@@Pyplane you're awesome!
Great explanation. Just add the "total" to the httpresponse instead of counting the seconds or searching the log. thumbs Up!
another great tutorial
Respect.
Thank you Muhammad :)
This is a most watch :)
very good tutorial , can i use async with class based views ? does django supports it ?
In as of Django 3.1 - docs.djangoproject.com/en/4.1/topics/async/#async-views
can we use this with django rest projects?
Amazing!!!
Thank you! 🙂
Thanks for this video.
Thanks for watching :)
When I define the post function in view as "async" like the async def main_view_async(), I keep getting this error:
AssertionError: Expected a `Response`, `HttpResponse` or `HttpStreamingResponse` to be returned from the view, but received a ``
What's the way around this?
thanks a lot mate keep the good work :)
Thanks for watching :) cheers!
awesome as always. tq so much :-)
thanks for watching :)
Dope video!
Thank you!:)
Nice job
great video thank you Lukas.
Hi Yuksel :) glad you liked it :))
@@Pyplane improvements are always good, thank you. And by the way i made it trough by atthost, finally it worked .
@@yukselbastan4687 Wowowow...congrats. That's a huge thing - make it work without knowing the Polish language. Congrats 100x !
@@Pyplane thank you very much, you as our teacher you should become the thanks ;), just one question please, can i work years with atthost without any problems i mean should i make a 5 year payment ?
@@yukselbastan4687 I don't know that :/ I pay annually each time
hi great tutorial as usual. i was finding something else and found you again. for example if we have 1000 requests data to show in template. can we show data of each request whenever request data returns like
request 1: loading
request 2: success here is your data value
request 3: success here is your data value
request4: loading
request5: fail etc
and each request is on different api
. feel like real app data. need it very badly any guide or help ?
Thank you, What if i did not use with the await command, is it impossible (line 56)?
Isn't Movie.objects.all() a sync function and hence blocks the requests?
@Pyplane awesome 😈😈😈😈😈
how to capture the return values from async get movie and async get stories in main view async
Thanks Luke!
Hi Daniel! Nice to hear from you again :) happy you liked the video :) Cheers!
@@Pyplane ohh my friend. That's great you remember me! I've learnt a lot from you. Keep going!. Dziękuję Ci!
@@danielaceros5723 Of course I do. My memory isn't perfect but I'll always remember the people who motivated me to carry on :) I am very happy and proud that you learned something from me :) Have a great day :) btw. nice Polish :))
Thanks!
Bro i am uploading images on GCP and then create entry in database but when i run it. It is only create entry not upload image
how to apply this concept to a real world example?
How to get async function orm result send back to temple
Hi, I like this method. But, i have 1 doubt. It it necessary to wait for task to complete as my task will take around 30 minutes to complete.
Hi. I don’t know the details of your task but maybe consider running it in the background? Cheers
@@Pyplane hi, i want hep regarding this. my view takes more than 6 seconds but timeout happens in 5 secinds. how do i send http response first and then do processing. in this example it waits in both cases. i dont want to wait. return response first and then do things. it is possible using async
@@ravikumarighare5297 use threading
@@coolrezaul thanks. threading worked
i tried this but this is not working. sync to async function also running synchronously
Try Django version 3.1
I have a question that how we get data from database without refreshing page. Else ajax because i read in one video comment that it is not good way.
I personaly don't work with ajax - the reason is that the code can get messy when building more advanced applications. For me a much better and easier way to do this is using django rest framework and react on the frontend. A tutorial on this will appear on the channel pretty soon. Cheers
@@Pyplane i am waiting for this and django channel
how much i wait for this..?
@@NotBeHaris the seconda part of the crypto app will be released at the beginning of September :)
AJAX or Websockets are the most common approach. The latter will be faster due to less network overhead
I just ran your code and I am seeing same result..
am i missing something..
For me also the sync and async requests have the same execution time. I used the code from git.
me too, what's going on?
It works in django 3.1 but not django 3.2
Also the same 7 secs regardless in Django 3.2
@@rodolfo4880-e4j i am also using 3.1.2 verison but result is same.
1.77K Subscribers nice :D
Not working. Please update or remove this video
Not really a good video. You doesn't explain very much, your toy example is too trivial to show something and also it just doesn't work as aspected. And yeah I saw the edited note about asyncio.sleep but if you can edit this you should have rather re-record this video.
Cool that you make videos to show off new stuff but please more effort the net is full of broken toy examples like this. Personally I don't want that python becomes the next js in this regard.