Django REST Framework Course - Build Web APIs with Python
HTML-код
- Опубликовано: 8 июл 2024
- Django REST Framework is a powerful and flexible toolkit for building Web APIs. In this course for beginner you will learn how to use Python and the Django REST Framework (DRF) to build a web API.
✏️ Course from Bobby Stearman. Check out @DidCoding
💻Code: github.com/bobby-didcoding/dr...
Other Resources:
www.python.org/
www.djangoproject.com/
www.django-rest-framework.org/
httpie.io/
curl.se/
www.docker.com/
⌨️ (0:00:00) Introduction
⌨️ (0:00:29) Module 1: Clone the code and set up our system
⌨️ (0:15:01) Module 2: Add settings and URL configurations
⌨️ (0:25:02) Module 3: Create first API endpoint
⌨️ (0:44:46) Module 4: Write unit tests
⌨️ (0:51:56) Module 5: Create endpoints with authentication
⌨️ (1:01:52) Module 6: Create item and order models and serializers
⌨️ (1:08:54) Module 7: Code viewsets and routers
⌨️ (1:14:30) Module 8: Write final unit tests
🎉 Thanks to our Champion and Sponsor supporters:
👾 Nattira Maneerat
👾 Heather Wcislo
👾 Serhiy Kalinets
👾 Erdeniz Unvan
👾 Justin Hual
👾 Agustín Kussrow
👾 Otis Morgan
--
Learn to code for free and get a developer job: www.freecodecamp.org
Read hundreds of articles on programming: freecodecamp.org/news
I had a lot of fun putting this course together. I hope everyone likes it.
hey! I love it
love ur content also remember ur 3rd party Google API's with django video
Thanks for the video!!! Perfect video for the start of the semester break in a week.
Can we can have course on API building with JAVA
@@rkdreamer1557, I think you didn't understand anything about RF and now you ask for java with spring which is much more complicated than the simple python...I think you didn't understand anything about RF and now you ask for java with spring which is much more complicated than the simple python with RF
Just a heads up and for anyone experiencing the same issues I had, in module 3 I was getting errors when running docker-compose stating that "Package 'netcat' has no installation candidate" and that was halting the whole process. Apparently you need to change "apt-get -y install netcat" to "apt-get -y install netcat-traditional" in both of the files Dockerfile and Dockerfile_app (found in the /backend/docker/docker_files folder), this allowed the docker-compose process to complete. Not sure if it will have any reprecussions later on in the course but if it does I'll edit this comment.
thx for sharing your profession, this method help me indeed!!
Thanks mate.
thank you so much
Thanks, I got the same error
You are a saint! And your comment should get pinned!
Incredible! I enjoyed the course a lot. Everything worked as expected and I managed to also start a project I wanted to do using Django APIs.
Incredible timing, I'm working my first DRF API right now. Thanks!
Glad it’s helped 👍
Hey can I ask you for some help bro ?
I think this is a great course. I've used django for a couple of years and this helped put things in a broader perspective. I got much more out of using Docker/Docker CLI. Great job.
thank you bobby for putting this together. I had a ton of fun building my first api ^^
At last DRF!!! Been waiting for this for a long time
Somehow you've managed to provide useful content in such a short period of time. Great Content, You've got a subscriber.
Can I ask you for some help bro ?
The tutorial I was waiting for 🤩
🙌
For those having issue with getting into virtual env, use command prompt terminal instead of powershell one.
I was waiting for this since a long time
Most awaited tutorial
Thanks you for what you're doing! 👍🏻
I got a perfect tutorial. Thanks bobby!
Thank you so much for this course!
Thank you very much! You are really great teacher
Thank you so much for this course.
Good course, but it's really unfortunate you skipped over so many essential core fundamentals. It makes it harder to follow if you're new, and expects you to know a lot of about Django if you want more than a basic understanding.
I get what you're saying, but you could've looked up their django for beginners video and then revisit this project. It's also a great learning experience for those who are still in school to utilize documentation when coming across a roadblock. That's how it will be once they start working.
Needed it the most!!!!
thx for your work and contribution.
very helpful and instructful video! thx
Hey..First of all thanks for your all video content that was very helpful and effective.
And I have a request for you please make a video on the salesforce platform. What and how does it work? How to make the project, implement, and design all the stuff.
I'm looking forward to hearing from you.
This channel is awesome.
Can I get a system design course if possible?? LLD and HLD with MERN stack examples.
Great Course really. Btw, which extension did you use for this arrows pointing towards code? It looks good :)
Very good content. Really appreciate the DRF explanation
Thanks for sharing 👌
In Module 3 I am getting error in container API(drf_course_api_1) logs as
exec /code/docker/entrypoints/entrypoint.sh: no such file or directory. Does anyone knows the solution?
In the Dockerfile remove the contents in ENTRYPOINT. ENTRYPOINT[ ]
Then rebuild and see if containers are running correctly. This fixed my issue.
@@ira3767 thank you so much it is working
@@ameetyadav7742 Hi were you able to make a post request?
@@oluwatosintheophilus5727 yes
@@ira3767 thank you!
Are you reading my mind? Thanks!
Amazing,
Thank you :)
Thank you so much ❤👍🙏🏻👌
We need a complete Django tutorial
I really wanted this course when I was thinking to connect my static react app with the django backend. Thanks freecodecamp for this awesome tutorial.
Please make a video on full stack app using django rest framework and reactjs.
+1 awesome idea
truely +1
This is an amazing and powerful tutorial, kinda advanced and do not recommend it at all if you're learning Django or DRF
Yet another course that promises to teach you stuff but only goes into its very specific area without offering more general methods
i was waiting for that
Amazing, thank you for putting such an amazing course together
I can't install Docker on my Windows 10 laptop because of a conflict with my video card drivers that causes a BSOD. In module 3, is there an alternative to using the docker-compose.yml file? I'm running Linux Mint in VirtualBox. Will I be able to use curl and HTTPie just fine without the contents of the .yml file?
I've also installed Postman for Windows. Could I not just use this instead?
can i just use the docker extension in VS Code
This video is not for beginners, u should mention that
Yes
good one thanks
hello , i'm a beginner but i hade to ask ! is this the right way to implement jwt-auth in django ?
as i know a jwt token is not something you put in database ! it's a long string that is create each time a user matches the records in database . so a jwt-token will change in evry authentification . if i inderstand correctly, the jwt-token is static for each user in this exemple .
thank you :)
at the end of module 3>> my docker container "drf_course-api-1 seems to be stuck on restarting. I've pulled the exact replica files from git to make sure it wasn't my error. still the same issue. great course
I understand that this issue is because of Linux - Windows end of line character (CRLF-LF issue). I don't know how to fix it.
Why don't we create the signals file in the core application, if it receives signals when a record of the User table is updated or created, it wouldn't make more sense to put it in the application where the Contact model is located.
Thank u so much.
Quick question. I just finished module 3 and my API container's log keep displaying "exec /code/docker/entrypoints/entrypoint.sh: no such file or directory". Can anyone I tried researching but cannot find the answer
@Emanuel If you have resolved this error can you share the solution?
In the Dockerfile remove the contents in ENTRYPOINT. ENTRYPOINT[ ]
Then rebuild and see if containers are running correctly. This fixed my issue.
@@ira3767 Worked perfectly for me! thanks! could you please explain why it works this way?
@@ira3767 thanks for commenting kindly also tell why this works if you have time
The issue could be because of windows line endings. If you have entrypoint.sh file saved with CRLF line ending resave it with Unix LF ending. That's helped me
Can we connect to a virtual server to fetch data through django
Does it cover swagger docs implementation?
In module 3 while running command 'docker-compose up -d --build' it shows me an error saying 'docker-compose is not recognized as the name of a cmdlet, function, script file, or operable program and so on.......'. What should I do in order to get rid of this error. I have tried reinstalling docker.
hi, did you resolve ?
I liked the course, but my only feedback is if some more attention was paid to the docker stuff rather than it being touched on a higher level
High quality demo screen
Thanks cool guy!
I had trouble running docker-compose. I got "E: Package 'netcat' has no installation candidate". Apparently debian repositories do not have that package anymore so had to change backend/docker/docker_files/Dockerfile and Dockerfile_app. I replaced 'netcat' with 'netcat-traditional' and docker-compose runs correctly. Just a heads up if someone is having same troubles.
Confirming Fix. Most will find issue in Module 3.
cheers mate
Issue fixed. Thank you!
What are the prerequisites for this course i know only python and Django and can perform basic CRUD operations in Django...
have hyper v, in other words have Windows 10 Pro, Windows 11 Pro. if you are notsoftware engineer. I have Windows 10 home language, so i can't execute docker (virtualizer).
@@humbertodavidramirezramos9453 ok got it...i can't buy windows pro...so can i use docker in Ubuntu ?
I have a problem that didn't run docker-api-1. I've changed crlf to lf at right bottom side on vscode
So overall i like the course. Im having some major issues though. I am new to django and am getting stuck in various areas. Usually I would be able to deduce and work backwards to figure out the issues but the virtual environment/docker/massive amount of copy/paste is making it basically impossible for me to follow where my error could be. I'm sure it makes things easier and more convenient but I can't troubleshoot this at all :/
Same here, I stoped watching at module 3 as things start get non-customiziable friendly
@@muntadher8087 me too. I got stuck in module 3 docker can't find entrypoint file. I understand that the problem is in the line ending difference between windows and linux but don't know how to fix it.
thank you
You are mapping title and description fields in the Serialzer to the name and message. But we don't have title and description fields in the Contact model. How its working?
Got it. You're getting the title and description because you're inheriting the Contact model from django_extensions.db.models.TitleDescriptionModel
I am excited about learning this. I completed module 1 but there were two things that did not happen as shown on video.
First, after activating the virtual environment using "venv\Scripts\activate.bat" I did not see the terminal display "(venv)" leading the path. I don't know how to find out if the virtual environment was activated.
Second, after installing the packages & requirements the pip installation reported a succesful install, but the packages are not shown under the venv>>Lib\site-packages directory as shown in video.
I perform a git checkout and pull origin and results displayed 'Already up to date.'
Did I do this right?
it probably isnt there are ways to check if the virtual environment is running. google through that you may have to do some bios tweaking to enable hardware virtualization like I did
in windows use venv\Scripts\activate instead of .bat one to activate the virtual environment
may be you will have to use activate.ps1 instead of activate.bat
Different terminals use different ways to activate virtual environment
For anyone else who comes to this issue, you should use Command Prompt instead Powershell or any other as your terminal. That seems to solve the (venv) problem.
Can we can have course on API building with JAVA
please can you build an e-commerce angular integrated with Django rest framework project?
Thanks
thanks ❤
I don't understand why the Flask app is needed? I created an image with Django and it works the same? Am I missing something? thanks!
The beard is back!
Great tutorial and very informative as well KUDOS but looking at things from a beginner’s perspective, it absolutely not beginners friendly at all. I can bet the individual will practically struggle through the whole thing. Meanwhile this is exceptional. Keep up the good work.
did you find any good resources for beginner?
@@raghav7988 Quite a lot available here on RUclips to get started with the technology. But it’s just that some are way better than the others without any doubt.
ok will check thanks @mat6plus
Adding "from dotenv import load_dotenv" is giving error that "Import dotenv could not be resolved", any idea what need to be done
have you installed the module? using pip or any other package manager
@@yoanbabulkov4316 Yes, it seems like already there. As when I tried pip to install, it came back with message requirement already satisfied.
Thanks for the help. I went back to all the steps, seems like I might have not properly done copy env.template command, as I am using mac. Used mv to copy and then, restarted the vscode and entered the env again and it worked.
@@singhalokk No worries, glad you managed to figure it out 😊
@@singhalokk This helped me, restarting VScode did the trick as I had already used the command. Thanks!
I really wish people would get over their fascination with docker. I don't want or need to learn docker, I came to learn Django Rest.
can anyone explain what '-r' means in pip install -r at 11:22
It’s an option you can access for the install command. It means Requirment file.
@@DidCoding @anton940 it simply means READ the file whichever you mention. in here its requirements.txt it reads it and installs the libraries are mentioned in that file.
niceeeeeeeeeee
gRPC when?
Cool
when running python -m venv venv in cmd I get error C:\Python27\python.exe: No module named venv
pip install venv
i get the following error when I use 'python'. ModuleNotFoundError: No module named 'django'. when I use 'python3' instead get no errors. should I concern about it? -> never mind. an alias for another python was in effect in venv.
make sure you run sith sudo and python 3 or python or python3.x , depending where did you installed the django
in module one my Django, the Rest framework, and a few other things did not install. Is there anyone else having this issue?
in the virtual environment folder
So type CTRL + P then type in the bar Python: Select Interpreter then press enter. Then select the python interpreter with the correct virtual environment.
(1:13:18) - High Briish
The API shows "restarting" all the time. There is an error "exec /code/docker/entrypoints/entrypoint.sh: no such file or directory". Anyone knows how to solve? help would be appreciated
replace last line of DockerFile from ENTRYPOINT ["/code/docker/entrypoints/entrypoint.sh"] to ENTRYPOINT ["sh", "/code/docker/entrypoints/entrypoint.sh"]
I'm having problems with docker. Could someone help me?
Successfully tagged djangoapi_app:latest
Creating djangoapi_app_1 ... done
Creating djangoapi_api_1 ... error
ERROR: for djangoapi_api_1 Cannot start service api: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/code/docker/entrypoints/entrypoint.sh": permission denied: unknown
ERROR: for api Cannot start service api: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/code/docker/entrypoints/entrypoint.sh": permission denied: unknown
ERROR: Encountered errors while bringing up the project.
Just apply "chmod +x backend/docker/entrypoints/entrypoint.sh" in any terminal and run docker-compose's command
you just messed up all the stuff with docker, you would have better explained it also, l mean the configuration.
Anyone having difficulty with this tutorial should first read the following books in the same order: Django for beginners -> Django for APIs -> Django for Professionals. You can start working on APIs with Django rest framework after reading the first 2 books. Peace!
Thank you for this comment! I saw this comment about a week and a half ago. I’ve finish reading Django for beginners and now I’m half way through Django for APIs. I must say so far I’ve came across things I didn’t knew in Django plus few of my questions were answered from previous Django courses I’ve took, and I’m understanding APIs much better now (before I was confused and fustrated). I cannot wait to finish Django for APIs and move on to Django for Professionals. Thanks again!
Btw if you have any other recommendations, let me know, at the moment I’m trying to become a python backend developer.
am getting this message from doccer API. and am stuck at 42:00 min please assist
exec /code/docker/entrypoints/entrypoint.sh: no such file or directory
Hey @DidCoding, sorry to be all geeky but I am getting this error while running docker,
ERROR: for drf_course_api_1 Cannot start service api: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/code/docker/entrypoints/entrypoint.sh": permission denied: unknown
I tried sudo with docker-compose but no change, also I have read online that there is something specific with shell scripts in linux but am not able to solve it, can you help?
Nevermind!! I found the answer as soon as I posted the comment.
chmod +x backend/docker/entrypoints/entrypoint.sh
@@ShobhitAsati thanks for the solution :)
@@stansemenov mention not !! :D
@@ShobhitAsati Thanks! What does that do and where did you find it?
@@ShobhitAsati hey,
how to use this?
I just miss async in Django
Your web for learning is very complicated I wish I could have made a used of it 😞
Who is the guy at start of every video?
Your voice reminds me of Peaky Blinders.
dude your setting up of the course needs a course itself.
WARNING: If you are a beginner, this tutorial is not for you. The guy kept cutting and pasting code, which is hard to follow and understand, except you have some foundation in Django and how REST web APIs work.
Instead of Copying and Pasting you should tell us what is the purpose of a certain thing.
Summary:
Lets copy this code and paste it.
This is not a deep dive in to drf
It's a poor tutorial. It is composed basically of copying and pasting code blocks for reasons than only the tutor or somebody experienced understand
the clone stuff is actualy worse causing a lot of errors, just show us what to install with pip and dont complicate it ...
It's nice to have structured steps to follow but felt like all he's doing is copying and pasting.
Please make a video how can I webcam live video streaming using django python. When any user strat live streaming Than any user can see it...
I'm trying to get into a coding bootcamp and I'm not qualified to pass the HackerRank 3 question challenge in order to do so. I'm willing to pay someone to do it for me (in bitcoin) -- I was supposed to have 2 months to prepare but I ended up with 2 days and I don't want to miss out.
understand++
As a .NET developer I can tell you that, it does not make any sense.
🤣
Too much copy and pasting here and there and not enough explanation of the code ...
First from Pakistan
Internet aagaya kya waha
@@sachitsankhe5102 g agya
@@developmentwithtariq bruh
@@sachitsankhe5102 Itni batameezi kyu karte ho yaar. Aise platforms pe to ye mat karo. Sadakchap hei kya tu?
@@user-ll9uu6nz9t tere pass toh Internet nhi hi hona chahiye tha
pls stop calling an example a 'course'. this was a nice video but not a course which teaches the fundamental working structure of rest_framework.
This doesn't really feel like a 'course'. All you really do is copy and paste things? I doubt anyone who completed this 'course' could actually do it again on their own.
Totally agree! Only the tutor and god understand why is he pasting all that code
Thank you for the service! But this course is not for me, since instructor goes over many copy-pasting and doesn't go over the documentation. Overall good projects though!