Тёмный

Django & React Tutorial #2 - Django REST Framework 

Tech With Tim
Подписаться 1,5 млн
Просмотров 254 тыс.
50% 1

This django and react tutorial covers how to use the django rest framework. We will use the django rest framework to implement a django REST API and setup some endpoints to use later in our project.
💻 AlgoExpert is the coding interview prep platform that I used to ace my Microsoft and Shopify interviews. Check it out and get a discount on the platform using the code "techwithtim" algoexpert.io/techwithtim
📚 Django Model Documentation: docs.djangoproject.com/en/3.1...
📝 Series Code: github.com/techwithtim/Music-...
📕 Node.js & NPM: www.npmjs.com/get-npm
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
💰 Courses & Merch 💰
💻 The Fundamentals of Programming w/ Python: tech-with-tim.teachable.com/p...
👕 Merchandise: teespring.com/stores/tech-wit...
🔗 Social Medias 🔗
📸 Instagram: / tech_with_tim
📱 Twitter: / techwithtimm
⭐ Discord: / discord
📝 LinkedIn: / tim-ruscica-82631b179
🌎 Website: techwithtim.net
📂 GitHub: github.com/techwithtim
🔊 Podcast: anchor.fm/tech-with-tim
🎬 My RU-vid Gear 🎬
🎥 Main Camera (EOS Canon 90D): amzn.to/3cY23y9
🎥 Secondary Camera (Panasonic Lumix G7): amzn.to/3fl2iEV
📹 Main Lens (EFS 24mm f/2.8): amzn.to/2Yuol5r
🕹 Tripod: amzn.to/3hpSprv
🎤 Main Microphone (Rode NT1): amzn.to/2HrZxXc
🎤 Secondary Microphone (Synco Wireless Lapel System): amzn.to/3e07Swl
🎤 Third Microphone (Rode NTG4+): amzn.to/3oi0v8Z
☀️ Lights: amzn.to/2ApeiXr
⌨ Keyboard (Daskeyboard 4Q): amzn.to/2YpN5vm
🖱 Mouse (Logitech MX Master): amzn.to/2HsmRDN
📸 Webcam (Logitech 1080p Pro): amzn.to/2B2IXcQ
📢 Speaker (Beats Pill): amzn.to/2XYc5ef
🎧 Headphones (Bose Quiet Comfort 35): amzn.to/2MWbl3e
🌞 Lamp (BenQ E-reading Lamp): amzn.to/3e0UCr8
🌞 Secondary Lamp (BenQ Screenbar Plus): amzn.to/30Dtafi
💻 Monitor (BenQ EX2780Q): amzn.to/2HsmUPZ
💻 Monitor (LG Ultrawide 34WN750): amzn.to/3dSD7tS
🎙 Mic Boom Arm (Rode PSA 1): amzn.to/30EZw9m
🎚 Audio Interface (Focusrite Scarlet 4i4): amzn.to/2TjXsih
💸 Donations 💸
💵 One-Time Donations: www.paypal.com/donate?hosted_...
💰 Patreon: / techwithtim
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
⭐️ Tags ⭐️
- Tech With Tim
- Django and React
- Python Django
- Javascript React
- Django and React Tutorial
- React and Django Project
- Django REST Framework
- Django REST API
- REST API Django
- REST API
⭐️ Hashtags ⭐️
#Django #React #JavaScript

Опубликовано:

 

8 ноя 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 335   
@queenfrimpong6788
@queenfrimpong6788 3 года назад
I actually gave myself a pat on the back like Tim told us to. :)
@tanmoyjoy1306
@tanmoyjoy1306 3 года назад
I have been through many react and django courses. But you are the best by far. Easy explanations and clean coding style. Hats off to you man!
@programmingpersistence5716
@programmingpersistence5716 2 года назад
yeah he is good
@victoritodo7544
@victoritodo7544 Год назад
Hi Tim, thanks so much for this tutorial. It covers a whole lot about React and Django! Really helpful!
@parthkabra8880
@parthkabra8880 3 года назад
I tried learning python's django a lot of time and got to understand nothing, so left everytime... But learnt react js and mastered it! Now i am not gonna leave this anytime and apply it to my react js and react native applications ! Thanks a lot needed indeed!
@hareee234
@hareee234 10 месяцев назад
small change as of AUG 2023, it is now required to explicitly state all fields of the associated model will be included in the serializer with `fields = '__all__'`
@salal_guitar5583
@salal_guitar5583 Год назад
Super helpful! Thank you for this series!
@drewskiiiiiiiii
@drewskiiiiiiiii 3 года назад
These videos are fantastic. Thank you!
@yas1467
@yas1467 3 года назад
I love this series!! pls do more web apps with python & javascript!
@pipe3194
@pipe3194 3 года назад
Loving the serie! 🚀
@hungdoan9148
@hungdoan9148 3 года назад
The "pylint Path" killed me for like an hour!
@brydenbarbee4528
@brydenbarbee4528 3 года назад
This was helpful to me stackoverflow.com/questions/62473201/how-do-i-enable-pylint-in-vscode
@MagicByIzzy
@MagicByIzzy 3 года назад
Thx Tim really cool! Love your vids
@ruksharalam173
@ruksharalam173 Год назад
Clear, concise, the audio is high quality,
@benhafsailhem6930
@benhafsailhem6930 Год назад
Awesome tutorial!
@TechWithTaha
@TechWithTaha 3 года назад
Excellent video Tim love your content keep going bro
@Cubie3D
@Cubie3D 3 года назад
it would be better if u can explain serializer and rest framework.
@shawnbeans7389
@shawnbeans7389 3 года назад
6:08 tim: thats what django was trying to tell us to do captions: thats what jane was trying to tell us to do
@mskyba
@mskyba 3 года назад
@Kelvin Jack are you guys the same people behind the InstaPwn scam, there's always two people involved
@JoaoCoelho0
@JoaoCoelho0 Год назад
This video is pure gold, even 2 years after it was created. Thank you so much!
@ytbook9639
@ytbook9639 Год назад
Bro please help me with react routing system because the one used in the video is outdatet how do i fix it it shows nothing on my page
@behjaf
@behjaf 3 года назад
Thank you. thank you. thank you. keep going
@johnkriervillanueva5112
@johnkriervillanueva5112 3 года назад
This is sooo helpful Tim! I'm literally crying right now bc you solved my problems 💮
@abdallahkhalaf8973
@abdallahkhalaf8973 3 года назад
i liked this video it's my first time using rest framework thanks
@RedionXhepa
@RedionXhepa 3 года назад
Nice job !
@ShanakaMadhushan-cw8rh
@ShanakaMadhushan-cw8rh 3 месяца назад
greate job sir thanks
@JoeyJurjens
@JoeyJurjens 3 года назад
Room.objects.filter(code=code).exists() is a method specifically designed to check if it exists or not. In your serializer, you can also do; fields = ‘__all__’ Cool video series btw!
@behjaf
@behjaf 3 года назад
can you please explain it more ? please write a full code
@JoeyJurjens
@JoeyJurjens 3 года назад
@@behjaf Well, the way Tim is checking if a room exists (when creating a random code), he does: Room.objects.filter(code=code).count() == 0. While the django way would be: if not Room.objects.filter(code=code).exists() And for the second thing, he enters fields one by one now. While if you want all fields to be used, you can do fields = “__all__” instead.
@behjaf
@behjaf 3 года назад
@@JoeyJurjens thank you Joey😇
@surya_ch3809
@surya_ch3809 3 года назад
@Shifa Shaikh misspell at max_length
@varunpusarla2590
@varunpusarla2590 3 года назад
Phew! Thanks man. I had a hard time getting this.
@monicapereznogueras7383
@monicapereznogueras7383 2 года назад
these videos are the best
@CompSciCentral
@CompSciCentral 3 года назад
I love that these are sponsored by AlgoExpert. You and Clement are my goals :D
@oruchkin
@oruchkin 2 года назад
Veryu good thank you!
@drizer4real
@drizer4real 3 года назад
Cool video!
@kauasteliano6292
@kauasteliano6292 3 года назад
Your tutorials are getting better every day, congratulations man, You have an awesome yt channel :D
@Heresjaken
@Heresjaken 3 года назад
Damn, got to video 2 and realized they are only just now getting released.... Will be keen to watch the rest. This is a very good tutorial, very straight forward.
@samcodes2912
@samcodes2912 3 года назад
yes really detailed
@rayaanibrahim4808
@rayaanibrahim4808 3 года назад
That’s lit 🔥 man keep going
@omaribrahim180
@omaribrahim180 3 года назад
Uh 😒 what do u mean rayaan
@rayaanibrahim4808
@rayaanibrahim4808 3 года назад
🔥 lit means cool and fire
@warka9494
@warka9494 3 года назад
i wonder Why would anybody dislike this video? Thanks Tim for this tutorial
@samcodes2912
@samcodes2912 3 года назад
for sure by mistake
@peidraou
@peidraou 3 года назад
best video brother.
@pedrostanzani2238
@pedrostanzani2238 3 года назад
Awesome tutorials Tim, keep 'em coming! Regards from Brazil!
@victoralmeida414
@victoralmeida414 2 года назад
Hey man! Brazil here as well! I'm trying to learn how to code, it has been a Journey full of challenges but I'll get there!
@maransowthrikalailingam9796
@maransowthrikalailingam9796 3 года назад
Instead of mentioning all the fields (one by one) in Meta class, you can simply put fields = '__all__'
@ishanpokhrel5972
@ishanpokhrel5972 3 года назад
Thanks man saved me a lot a time
@jimshapedcoding
@jimshapedcoding 3 года назад
Could that been done this way by purpose? Maybe he will move some of the fields under the variable of read_only_fields in the future so it will be easier to just cut and paste those.
@KopfKino901
@KopfKino901 3 года назад
Didn't he list them all because he wanted to have the possibility of adding a custom 'id' one ?
@AshrafFaris
@AshrafFaris 3 года назад
@@KopfKino901 No even if he used '__all__' the id will be added too
@maransowthrikalailingam9796
@maransowthrikalailingam9796 3 года назад
are you serious?
@fabu324
@fabu324 3 года назад
Your tutorials are always perfect and include everything I want to learn and need. Just a very big thankyou again!!!❤️
@avgoustisavgousti5544
@avgoustisavgousti5544 21 день назад
thanks a lot
@amirm8420
@amirm8420 3 года назад
Love you😍😍😍
@KoksMOks
@KoksMOks 3 года назад
dope i hope it will be daily:D
@ebrahimsattar486
@ebrahimsattar486 3 года назад
Thanks Tim! You are the best!
@fojirngers3661
@fojirngers3661 3 года назад
Finally please keep going. Love your tutorials bro
@ilyesnegadi5422
@ilyesnegadi5422 2 года назад
We can use uuid to generate unique token for the room we just have to redfine the init function to call the function how handle this
@mdbarin2014
@mdbarin2014 7 месяцев назад
thanks
@yaxpatel
@yaxpatel 3 года назад
thanks for the great videos Tim
@toufiqulislamimran7911
@toufiqulislamimran7911 3 года назад
i just finished the part 1....and you uploaded the part 2....i thought i have to wait for it ....but its here now ....thanks bro
@kevinmontero4158
@kevinmontero4158 3 года назад
Hi Tim! Thank you for this great tutorial! Just curious, any reasons why you mentioned in 5:58 that models should be 'fat' and views should be 'thin'? My current practice is keeping the heavy logic in the views rather than models.
@dawid_dahl
@dawid_dahl 3 года назад
I was also surprised by this and would like to know more about that reasoning.
@luketrop9431
@luketrop9431 3 года назад
same
@roymarshall_
@roymarshall_ 2 года назад
I believe its to keep functionality that is related to data as close to that data as possible, instead of spread out
@keno0813
@keno0813 Год назад
When you generate unique code do you not have to call the function or will it just run by default?
@nguyenvanhieu9589
@nguyenvanhieu9589 3 года назад
Keep your awesome
@mshimanshu1000
@mshimanshu1000 3 года назад
Thank's tim ..... ! ..... your video's are really helpful
@zachfenton608
@zachfenton608 2 года назад
Great series but i am having a problem with the following error: "detail": "Method \"GET\" not allowed." I tried changing the setting and searched how to allow it run a get request... still need to do more searching.
@itzHD
@itzHD 3 года назад
Will you be deploying it too?
@andrewsessilfie9383
@andrewsessilfie9383 3 года назад
when am going to the room view. if if I do api/home. it does not work. but when I write just /home, then I get the view
@user-uf6qe2gy2x
@user-uf6qe2gy2x Год назад
12:28 you can just type "__all__" to avoid typing out all the fields manually if i am not mistaken
@vikramnayyar2752
@vikramnayyar2752 3 года назад
As someone who has been binging React builds recently but is better at Python (for vanilla coding, Python > Vanilla JavaScript), this series is PERFECT for me!!! Keep up the good work Tim!
@cairink2110
@cairink2110 3 года назад
Which font do you use in vs code?
@pedroribeiro6271
@pedroribeiro6271 3 года назад
Again huge thanks for this. I wish you could do longer videos. I know you must be pretty busy.. but still 20 min every 2 or 3 days is so short :( Love the content
@samcodes2912
@samcodes2912 3 года назад
so true
@siddhantchavan1370
@siddhantchavan1370 3 года назад
why do we need to add code and host to model?Like I have learned sql but I wouldnt add it to models? Somebody explain
@aadityamunjal7861
@aadityamunjal7861 3 года назад
Appriciate you videos Tim! Can your next Time out with Tim be with thenewboston since Bucky's back? Thanks.
@CompSciCentral
@CompSciCentral 3 года назад
I second this! I got started on Bucky!
@ShubhamSingh-uu8ci
@ShubhamSingh-uu8ci 3 года назад
Hey Tim, excellent video, just had one single problem i.e I didn't get the form to input data into the db although I followed the exact same steps and even tried cloning the git repository for the particular tutorial, please help.
@shresthabasak873
@shresthabasak873 Месяц назад
facing the same issue
@RajatGupta-lq3cb
@RajatGupta-lq3cb 3 года назад
can someone help me? I'm getting a no such column error page when I post in Room
@talalbadreddine3155
@talalbadreddine3155 3 года назад
idk if I'm late , but i think the problem here is in the serializers file in fields u may have a error of copying :)
@galaxy_apollo13
@galaxy_apollo13 3 года назад
Hey Tim, I just want to thank you again for making these videos. I watched almost all of your videos and learned various programming concepts from you. Keep up your good work on your youtube channel. You deserve at least 1 million subscribers.
@TechWithTim
@TechWithTim 3 года назад
You're very welcome!
@kiransalve403
@kiransalve403 3 года назад
please make projects on Shipping management system in django
@dell4559
@dell4559 2 года назад
I am getting an Error in 16:30 Can anyone please help me??? Error As :- 'TodoView' should either include a `serializer_class` attribute, or override the `get_serializer_class()` method.
@user-pp6mm5eo7d
@user-pp6mm5eo7d 3 года назад
Template does not exist at api/home... please help
@vinamr3945
@vinamr3945 3 года назад
I am getting this error message: Traceback (most recent call last): File "c:/Users/Vinu/Downloads/React-Django/music_controller/api/serializers.py", line 2, in from .models import Room ImportError: attempted relative import with no known parent package
@kanharusia9399
@kanharusia9399 3 года назад
Hello Tim Some things I want to learn are : 1. Logging System with 2 views administrator privileges and Customer privilages. 2. Upload Image for example change profile picture. Thanks Ankit Rusia
@amanborse8968
@amanborse8968 3 года назад
Use roles or groups for Logging System with 2 views administrator privileges and Customer privilages..
@alanominatorkiborg5860
@alanominatorkiborg5860 2 года назад
Cool.
@lyteral7
@lyteral7 3 года назад
I haven't been able to makemigrations successfully after creating the model Room.. Each time i run the commands at 9:23 it gives me the output: No changes detected Have tried deleting my migrations and doing again as suggested elsewhere, but this does not seem to fix the problem.. Any help or suggestions are appreciated.. EDIT : I managed to fix the issue.. For anyone else who had this same issue and got OperationalError later, try making an empty folder named migrations in the api folder and then make an empty __init__.py file and then try makemigrations, migrate and finally runserver..
@user-se7yq6cl2j
@user-se7yq6cl2j 3 года назад
usualli it happens bd you forget to add your app in settings of your project
@therandom2032
@therandom2032 3 года назад
Thank You so much, this is exactly what happened to me and it worked
@luzestelalizarragacortez2642
@luzestelalizarragacortez2642 3 года назад
@@user-se7yq6cl2j Thank you so much, I got stuck with this a lot
@abdullahfawzy9556
@abdullahfawzy9556 3 года назад
It came in the perfect time
@ytbook9639
@ytbook9639 Год назад
please help me with react routing system because the one used in the video is outdatet how do i fix it it shows nothing on my page
@andreanonali4557
@andreanonali4557 3 года назад
Really nice video Tim. It will be interesting seeing a GraphQL REST API I think "fat models and thin views" does not mean put the logic, but put, in models, helper method for the controller to make logic thinner.
@samcodes2912
@samcodes2912 3 года назад
smart suggestion
@davidkorn5253
@davidkorn5253 Год назад
tim the 🐐
@sarveshdubey9312
@sarveshdubey9312 3 года назад
As i am saving my settings.py, it is showing me an error and is not producing any link after i am running the command 'python manage.py runserver' to connect to server. Why is it so ?
@normn0
@normn0 7 месяцев назад
@Tim I had Codeium autocomplete on (similar to Tabnine or Github Copilot) and after a few lines it started predicting every block I was about to type with 100% accuracy. That means your code is in the GPT (I am pretty certain Codeium is GPT powered) database. Congratulations Tim?! Or sorry? Not sure...
@goose7453
@goose7453 3 года назад
Yay!
@mdjahidhasan513
@mdjahidhasan513 3 года назад
without DRF is it possible to communicate with Django?
@sidheshwar2971
@sidheshwar2971 3 года назад
im getting a error room has no objects why that so
@gladsonsebastian4464
@gladsonsebastian4464 3 года назад
Most of students having a doubt that, Did we stick to just one programming language or learning multiple languages helps us in the future.With python what types of jobs can I'm able to apply.If you do a video about this that would be really helpful.
@migueldomingos4570
@migueldomingos4570 3 года назад
My advice is learning at least two languages of higher level and then learn a lower level language. This will give you a good understanding of computer science in my humble opinion. More related to the topic of this video python django and javascript react are a a amazing combo to make websites and web apps. But i would also recommend trying the mern stack(mongo db- no sql database; express - javascript backend framework; react; n - nodejs - javascript runtime to run javascript outside the browser). Or a more enterprise stack is java swing for the backend and angular(javascript framework similiar to react(@ben awad please dont kill me)).
@gladsonsebastian4464
@gladsonsebastian4464 3 года назад
@@migueldomingos4570 Thank you very much sir, for spending your valuable time for me ♥️.
@migueldomingos4570
@migueldomingos4570 3 года назад
@@gladsonsebastian4464 You are welcome and good luck with your RU-vid journey
@thejonellwood
@thejonellwood Год назад
I can not figure out why the feildset for the form is not present in my view.... maybe one of the methods is deprecated? I would think that would create an error... any pointers. FYI I like getting errors like this because debugging is such a great way to learn..... when you can actually figure it out lol
@El-Reyo
@El-Reyo Месяц назад
Done.
@I65Sports
@I65Sports Год назад
I’m noticing if you’re python3 you can’t put a .before the path. Is my assessment correct ???
@pietroprovinzano4629
@pietroprovinzano4629 3 года назад
Nice Tutorial Tim, keep going with this series. Can I use rest_framework and serializers also with angular? Thanks.
@migueldomingos4570
@migueldomingos4570 3 года назад
Sure. You just need an API made with any backend framework and then JavaScript in the front-end can call that API using something like fetch or a more framework specific fetching library. And yes angular has JSON serializers since it is a built-in feature into JavaScript itself
@salmanbehen4384
@salmanbehen4384 3 года назад
Ok, guys help me out here, if I learn Django, React and Mongoose do I become full-stack. If no then what do I gotta do?
@ojouniisama5401
@ojouniisama5401 3 года назад
That should be good.. You can also learn about web hosting and other stuff
@tanmaydeshpande
@tanmaydeshpande 3 года назад
Amazing tutorials as always Tim! I have been subscribed for a year now and have learnt so much from you! Thank you for these videos
@entername2954
@entername2954 3 года назад
Can someone help me pleas. I keep getting an error in the models.py file. The error is referring to the if statement in the generate_unique_code() funtion at 8:58. invalid syntax (, line 15) pylint(syntax-error) [15,56]
@austonlarson6563
@austonlarson6563 3 года назад
I believe the issue is that he is using an assignment operator "=", when he should be using a comparison operator "==". So the code should read: if Room.objects.filter(code==code).count() == 0:
@entername2954
@entername2954 3 года назад
​@@austonlarson6563 This solved the problem. Thanks a lot!!
@xLaoztu
@xLaoztu 2 года назад
getting this error after i try to post "OperationalError at /api/home no such column: api_room.code" *EDIT in the models host needed to have a default of none host = models.CharField(max_length=50, unique=True, default=None,)
@rraajjaannrraajjaann2037
@rraajjaannrraajjaann2037 3 года назад
how to fix? ImportError: cannot import name 'RoomSerializar' from 'api.serializers' (C:\Users\dell\Favorites\Desktop\python and js\music_controller\api\serializers.py) how to fix?
@aishikbandyopadhyay8191
@aishikbandyopadhyay8191 3 года назад
First like, sir! Was waiting extremely eagerly for the 2nd part😀😀❤️🔥🙏
@rdius4822
@rdius4822 3 года назад
Aaaahhhhh stop using those emojis REEEEEEEEEEEEEEE
@aishikbandyopadhyay8191
@aishikbandyopadhyay8191 3 года назад
@@rdius4822 sorry bro, can't stop me😁
@rdius4822
@rdius4822 3 года назад
@@aishikbandyopadhyay8191 you're using them excessively...
@kdthreefive
@kdthreefive 3 года назад
i cannot see the html form. can someone help me fix this please
@zro3698
@zro3698 2 года назад
when I remove the main def in views I get Import Error: cannot import name 'main' from 'api.views' any ideas how to fix?
@challaphanideep
@challaphanideep Год назад
Its soo good.but without generate_unique_code(): in model also its working fine; where you used this.
@pilote111
@pilote111 2 года назад
I need help! I'm not getting the form and don't know why 😭
@brydenbarbee4528
@brydenbarbee4528 3 года назад
Trying to make migrations at about 15:20 but getting an error of ModuleNotFoundError: No module named 'api.serlializer'. Anyone else getting this error or know what the fix might be?
@nomadntribe5431
@nomadntribe5431 3 года назад
same error here, sadly no answer
@rachit6099
@rachit6099 3 года назад
was waiting for it thanks how are you doing
@VS-vf8xh
@VS-vf8xh 2 года назад
OperationalError at /api/home help?
@lorazubic9873
@lorazubic9873 Месяц назад
is this app made using mvc arhitecture?
@AhmedElrefaay-cc5nh
@AhmedElrefaay-cc5nh Месяц назад
here!
@naiadbaksh3996
@naiadbaksh3996 2 года назад
Does anyone know how to deploy this? Please help.
@mtshgaming292
@mtshgaming292 3 года назад
honestly before this tutorial i used php laravel which is similar but the syntax of php is disgusting im looking to switch to python django thank you tim like always
@dipusarker8072
@dipusarker8072 3 года назад
Will u tell us your vs code extension plz??
@binaprajapati7709
@binaprajapati7709 3 года назад
he went through it in the 1st tutorial sorry I know I am late
@RocseyXAmine
@RocseyXAmine 3 года назад
❤️
Далее
Django REST Framework - Build an API from Scratch
40:39
The Story of React Query
8:55
Просмотров 90 тыс.
Django Rest Framework | Serializers & CRUD
22:40
Просмотров 380 тыс.
This UI component library is mind-blowing
8:23
Просмотров 602 тыс.
Django Rest Framework for Beginners - Simple CRUD API
14:22
How To Structure A Programming Project…
19:00
Просмотров 87 тыс.