Django REST Framework Course - Build Web APIs with Python
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
Пікірлер: 230
I had a lot of fun putting this course together. I hope everyone likes it.
@gameboyv1790
Жыл бұрын
hey! I love it
@aryanjain5535
Жыл бұрын
love ur content also remember ur 3rd party Google API's with django video
@joshurlay
Жыл бұрын
Thanks for the video!!! Perfect video for the start of the semester break in a week.
@rkdreamer1557
Жыл бұрын
Can we can have course on API building with JAVA
@josbexerra8115
Жыл бұрын
@@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.
@twpierce1730
Жыл бұрын
thx for sharing your profession, this method help me indeed!!
@juanarango4917
Жыл бұрын
Thanks mate.
@FatmavHassan
Жыл бұрын
thank you so much
@mallickpriyanshu
10 ай бұрын
Thanks, I got the same error
@kenk4552
10 ай бұрын
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!
@DidCoding
Жыл бұрын
Glad it’s helped 👍
@legendsanimexy8217
9 ай бұрын
Hey can I ask you for some help bro ?
thank you bobby for putting this together. I had a ton of fun building my first api ^^
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.
At last DRF!!! Been waiting for this for a long time
The tutorial I was waiting for 🤩
@DidCoding
Жыл бұрын
🙌
Somehow you've managed to provide useful content in such a short period of time. Great Content, You've got a subscriber.
@legendsanimexy8217
9 ай бұрын
Can I ask you for some help bro ?
I was waiting for this since a long time
Most awaited tutorial
Needed it the most!!!!
Thank you so much for this course!
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
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.
@kamanzirama-munroe5560
11 ай бұрын
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.
For those having issue with getting into virtual env, use command prompt terminal instead of powershell one.
thx for your work and contribution.
very helpful and instructful video! thx
Amazing, Thank you :)
Thanks for sharing 👌
i was waiting for that
This channel is awesome. Can I get a system design course if possible?? LLD and HLD with MERN stack examples.
Very good content. Really appreciate the DRF explanation
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.
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?
@ira3767
Жыл бұрын
In the Dockerfile remove the contents in ENTRYPOINT. ENTRYPOINT[ ] Then rebuild and see if containers are running correctly. This fixed my issue.
@ameetyadav7742
Жыл бұрын
@@ira3767 thank you so much it is working
@oluwatosintheophilus5727
Жыл бұрын
@@ameetyadav7742 Hi were you able to make a post request?
@ameetyadav7742
Жыл бұрын
@@oluwatosintheophilus5727 yes
@irabor18
Жыл бұрын
@@ira3767 thank you!
Great Course really. Btw, which extension did you use for this arrows pointing towards code? It looks good :)
Thank you so much ❤👍🙏🏻👌
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?
Are you reading my mind? Thanks!
good one thanks
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.
@balazssrancsik1691
Жыл бұрын
+1 awesome idea
@Hahm28
Жыл бұрын
truely +1
Thank u so much.
Amazing, thank you for putting such an amazing course together
Thanks cool guy!
can i just use the docker extension in VS Code
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.
We need a complete Django tutorial
I have a problem that didn't run docker-api-1. I've changed crlf to lf at right bottom side on vscode
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
@Thwaha
Жыл бұрын
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.
Can we connect to a virtual server to fetch data through django
This is an amazing and powerful tutorial, kinda advanced and do not recommend it at all if you're learning Django or DRF
Does it cover swagger docs implementation?
thanks ❤
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
@ameetyadav7742
Жыл бұрын
@Emanuel If you have resolved this error can you share the solution?
@ira3767
Жыл бұрын
In the Dockerfile remove the contents in ENTRYPOINT. ENTRYPOINT[ ] Then rebuild and see if containers are running correctly. This fixed my issue.
@erick2051
Жыл бұрын
@@ira3767 Worked perfectly for me! thanks! could you please explain why it works this way?
@harshasaiIT
Жыл бұрын
@@ira3767 thanks for commenting kindly also tell why this works if you have time
@keshameer9404
Жыл бұрын
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
Cool
Yet another course that promises to teach you stuff but only goes into its very specific area without offering more general methods
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.
@jacojames
6 ай бұрын
Confirming Fix. Most will find issue in Module 3.
@marek3213
3 ай бұрын
cheers mate
@giannisk9043
2 ай бұрын
Issue fixed. Thank you!
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.
@polynomen
Жыл бұрын
hi, did you resolve ?
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!
niceeeeeeeeeee
The beard is back!
Can we can have course on API building with JAVA
please can you build an e-commerce angular integrated with Django rest framework project?
What are the prerequisites for this course i know only python and Django and can perform basic CRUD operations in Django...
@humbertodavidramirezramos9453
10 ай бұрын
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).
@ANTICHRIS619
10 ай бұрын
@@humbertodavidramirezramos9453 ok got it...i can't buy windows pro...so can i use docker in Ubuntu ?
This video is not for beginners, u should mention that
@iamajaydarji
11 ай бұрын
Yes
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
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?
@web_angle
Жыл бұрын
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?
@Kithas
Жыл бұрын
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
@tusharverma4202
Жыл бұрын
in windows use venv\Scripts\activate instead of .bat one to activate the virtual environment
@Thwaha
Жыл бұрын
may be you will have to use activate.ps1 instead of activate.bat
@MrHadev
Жыл бұрын
Different terminals use different ways to activate virtual environment
@god_trueking
8 ай бұрын
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.
you just messed up all the stuff with docker, you would have better explained it also, l mean the configuration.
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 :/
@muntadher8087
Жыл бұрын
Same here, I stoped watching at module 3 as things start get non-customiziable friendly
@Thwaha
Жыл бұрын
@@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.
@qb4745
Жыл бұрын
thank you
Adding "from dotenv import load_dotenv" is giving error that "Import dotenv could not be resolved", any idea what need to be done
@yoanbabulkov4316
Жыл бұрын
have you installed the module? using pip or any other package manager
@singhalokk
Жыл бұрын
@@yoanbabulkov4316 Yes, it seems like already there. As when I tried pip to install, it came back with message requirement already satisfied.
@singhalokk
Жыл бұрын
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.
@yoanbabulkov4316
Жыл бұрын
@@singhalokk No worries, glad you managed to figure it out 😊
@TheWishDragon
Жыл бұрын
@@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.
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.
@raghav7988
Жыл бұрын
did you find any good resources for beginner?
@mat6plus
Жыл бұрын
@@raghav7988 Quite a lot available here on KZread to get started with the technology. But it’s just that some are way better than the others without any doubt.
@raghav7988
Жыл бұрын
ok will check thanks @mat6plus
when running python -m venv venv in cmd I get error C:\Python27\python.exe: No module named venv
@faizannazir5596
Жыл бұрын
pip install venv
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
@SalmanSaleem92
4 ай бұрын
replace last line of DockerFile from ENTRYPOINT ["/code/docker/entrypoints/entrypoint.sh"] to ENTRYPOINT ["sh", "/code/docker/entrypoints/entrypoint.sh"]
can anyone explain what '-r' means in pip install -r at 11:22
@DidCoding
Жыл бұрын
It’s an option you can access for the install command. It means Requirment file.
@hemalpatel3770
6 ай бұрын
@@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.
(1:13:18) - High Briish
in module one my Django, the Rest framework, and a few other things did not install. Is there anyone else having this issue?
@acedogg90
Жыл бұрын
in the virtual environment folder
@fulltimelinux
Жыл бұрын
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.
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.
@georgianmusat9958
11 ай бұрын
make sure you run sith sudo and python 3 or python or python3.x , depending where did you installed the django
gRPC when?
understand++
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.
@ArnaldoParedesMarchena
Жыл бұрын
Just apply "chmod +x backend/docker/entrypoints/entrypoint.sh" in any terminal and run docker-compose's command
Your web for learning is very complicated I wish I could have made a used of it 😞
dude your setting up of the course needs a course itself.
I just miss async in Django
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.
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?
@ShobhitAsati
Жыл бұрын
Nevermind!! I found the answer as soon as I posted the comment. chmod +x backend/docker/entrypoints/entrypoint.sh
@stansemenov
Жыл бұрын
@@ShobhitAsati thanks for the solution :)
@ShobhitAsati
Жыл бұрын
@@stansemenov mention not !! :D
@apk29
Жыл бұрын
@@ShobhitAsati Thanks! What does that do and where did you find it?
@yashraut9977
Жыл бұрын
@@ShobhitAsati hey, how to use this?
Who is the guy at start of every video?
am getting this message from doccer API. and am stuck at 42:00 min please assist
@ericmwangi1204
Жыл бұрын
exec /code/docker/entrypoints/entrypoint.sh: no such file or directory
Summary: Lets copy this code and paste it. This is not a deep dive in to drf
Instead of Copying and Pasting you should tell us what is the purpose of a certain thing.
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!
@DevinBrown-biz
8 ай бұрын
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.
Your voice reminds me of Peaky Blinders.
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 a poor tutorial. It is composed basically of copying and pasting code blocks for reasons than only the tutor or somebody experienced understand
It's nice to have structured steps to follow but felt like all he's doing is copying and pasting.
First from Pakistan
@sachitsankhe5102
Жыл бұрын
Internet aagaya kya waha
@developmentwithtariq
Жыл бұрын
@@sachitsankhe5102 g agya
@lalithrockz
Жыл бұрын
@@developmentwithtariq bruh
@user-ll9uu6nz9t
Жыл бұрын
@@sachitsankhe5102 Itni batameezi kyu karte ho yaar. Aise platforms pe to ye mat karo. Sadakchap hei kya tu?
@sachitsankhe5102
Жыл бұрын
@@user-ll9uu6nz9t tere pass toh Internet nhi hi hona chahiye tha
never seen a teacher worse than him
Too much copy and pasting here and there and not enough explanation of the code ...
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.
As a .NET developer I can tell you that, it does not make any sense.
@DidCoding
Жыл бұрын
🤣
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.
@erick2051
8 ай бұрын
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!
Why would anyone use this over fastapi? This is too much work