Django Rest Framework Course - Module 3

  Рет қаралды 1,157

Did Coding

Did Coding

Күн бұрын

Welcome to my DRF course.
Module 3:
In the last module, we constructed wired up two new applications and added the necessary code to fire up DRF's user interface. Let's expand on this and create our first API endpoint.
Nice and simple... We want a contact us endpoint so a user can send their name, email and message to our backend.
We need:
a) a model to capture store the incoming data
b) a router/url called '/contact/'
c) a serializer to process the data coming from the user and send a response back again.
d) a view to encapsulates the common REST HTTP method calls
easy, right?
PROJECT LINKS:
github.com/bob...
www.python.org/
www.djangoproj...
www.django-res...
httpie.io/
curl.se/
www.docker.com/
ABOUT OUR CHANNEL
Our channel is about coding a development. We cover lots of cool stuff such as Django, React, JavaScript, AJAX, Coding on DLT's
Check out our channel here:
/ @didcoding
Don’t forget to subscribe!
CHECK OUT OUR OTHER VIDEOS
• Building and launching...
• Integrating API's with...
• Hedera Hashgraph Pytho...
FIND US AT
www.didcoding.com
GET IN TOUCH
Contact us on bobby@didcoding.com
FOLLOW US ON SOCIAL
Get updates or reach out to Get updates on our Social Media Profiles!
Twitter: / didcoding
Facebook: / didcoding
SUPPORT US
Patreon: / didcoding
HBAR wallet: 0.0.1053688
HIRE ME
Need help with a project? Hire me on a freelance basis?
Upwork: www.upwork.com...
DISCOUNTS
Visit our website to get some fantastic discounts
didcoding.com/...

Пікірлер: 19
@amarmusovic7748
@amarmusovic7748 8 ай бұрын
Thanks for the great content! I find your way of copy/pasting code snippets and then explaining them works just fine, and makes the videos somewhat shorter. 👍👍
@DidCoding
@DidCoding 7 ай бұрын
Glad you enjoy the format 😀
@progravado5099
@progravado5099 Жыл бұрын
Thanks again, apreciate the effort and the content quality!
@DidCoding
@DidCoding Жыл бұрын
Thank you for the feedback
@s.nazeri2009
@s.nazeri2009 Жыл бұрын
thank you so much
@DidCoding
@DidCoding Жыл бұрын
🙌
@davidecastelli3200
@davidecastelli3200 Жыл бұрын
First of all, THANK YOU for videos!! You have done an amazing job !!! Anyway I followed all 3 models but I don't understand why nothing is working ehehhehe . First of all I had a problem to download NETCAT and choose btw tradional and openbsd. After choose netcat-traditional I have encoutered the endpoint's problem tackled already changig the permission. Even now after run the command build nothing is displaying in my docker desktop and i localhost doesn't change to api ... Do you have any tip to put me in the right path ????
@DidCoding
@DidCoding Жыл бұрын
Yeah it looks like something is broken. It’ll be hard for me to debug without the traceback. Also , it’s been a while since I’ve looked at this project. I know that some users had issues when running the containers on mac or Ubuntu… have you checked out the issues on GitHub? Bobby
@emanueltameklo6245
@emanueltameklo6245 2 жыл бұрын
Hi Bobby, I have completed all of module 3 and for some reason my API container is not working. I have researched some of the Docker docs and can't seem to find the solution. Would have any pointers to some basic troubleshooting that could help figure out the issue. Please and thank you.
@DidCoding
@DidCoding 2 жыл бұрын
Hi mate. I just emailed you. I think it’s the line endings. Try changing LF to CRLF on the dockerfiles.
@DidCoding
@DidCoding 2 жыл бұрын
And entry points
@DiederikNomden
@DiederikNomden 2 жыл бұрын
Hi Bobby, I followed all steps (script for is slightly different from the one you're showing in your video, class ContactViewSet is called ContactAPIView in my downloaded script), and somehow no endpoint 'contact' has been made on the server... Could you help me out? Thanks!
@DidCoding
@DidCoding 2 жыл бұрын
There were some alterations made to the repo. Have you added the url? If in doubt, pull down the code from the following module 👍 Thanks Bobby
@travishetzel
@travishetzel 2 жыл бұрын
If an ""exec: \"/entrypoint.sh\": permission denied" error shows up: cd into docker/entrypoints and enter "chmod +x entrypoint.sh" into the terminal and rebuild via "docker-compose up -d --build"
@DidCoding
@DidCoding 2 жыл бұрын
Yeah, some people have had the permission error. Changing the entry point command to the following also works: CMD [ "python", "manage.py" , "runserver"]
@kennytanner1329
@kennytanner1329 2 жыл бұрын
Hi Bobby, I'm afraid my API container running into a similar issue exec /code/docker/entrypoints/entrypoint.sh: no such file or directory Any suggestions would be greatly appreciated! Also the request returns this error. http: error: ConnectionError: HTTPConnectionPool(host='api', port=8000): Max retries exceeded with url: /contact/ (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) while doing a POST request to URL: api:8000/contact/
@DidCoding
@DidCoding 2 жыл бұрын
This would suggest that you need to change permission on the bash file but this is done in the Dockerfile. Try changing the dockerfile to the following. FROM python:3.10 ENV PYTHONUNBUFFERED 1 ENV PYTHONDONTWRITEBYTECODE 1 RUN set -e; apt-get update ; apt-get -y install netcat ; apt-get -y install gettext ; RUN mkdir /code COPY . /code/ WORKDIR /code RUN set -e; /usr/local/bin/python -m pip install --upgrade pip ; python -m pip install -r /code/requirements.txt ;\ EXPOSE 8000 CMD [ "python", "manage.py" , "runserver"] You will then need to run the following code in Docker CLI python manage.py makemigrations python manage.py migrate
@kennytanner1329
@kennytanner1329 2 жыл бұрын
@@DidCoding simply changing that final docker entry point line to CMD [ "python", "manage.py" , "runserver"] appears to have done the trick. Thanks!!
@DidCoding
@DidCoding 2 жыл бұрын
@@kennytanner1329 🙌
Django Rest Framework Course - Module 4
14:12
Did Coding
Рет қаралды 558
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 918 М.
진짜✅ 아님 가짜❌???
0:21
승비니 Seungbini
Рет қаралды 10 МЛН
UFC 287 : Перейра VS Адесанья 2
6:02
Setanta Sports UFC
Рет қаралды 486 М.
Django Rest Framework Course - Module 5
13:53
Did Coding
Рет қаралды 440
Build a Kubernetes AI Security Audit Agent with LangGraph
16:40
Abhay Bhargav
Рет қаралды 187
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 296 М.
Django Rest Framework Course - Module 6
13:11
Did Coding
Рет қаралды 395
Watch This Before Using Django With MongoDB
9:18
Dennis Ivy
Рет қаралды 46 М.
Django Rest Framework Course - Module 8
20:03
Did Coding
Рет қаралды 673
진짜✅ 아님 가짜❌???
0:21
승비니 Seungbini
Рет қаралды 10 МЛН