Python Microservices Web App (with React, Django, Flask) - Full Course
HTML-код
- Опубликовано: 24 июл 2024
- Using Python microservices allows you to break up your apps into smaller parts that communicate with each other. This can make it simpler to scale the application based on the traffic. Also, the separation of concerns makes it easier to work on just one part of the app at a time.
💻 Code - Python Microservices: github.com/scalablescripts/py...
💻 Code - React: github.com/scalablescripts/re...
✏️ Course developed by Scalable Scripts. Check out their channel: • Laravel Microservices ...
⭐️ Course Contents ⭐️
⌨️ (0:00:00) What are Microservices?
⌨️ (0:02:29) Project Introduction
⌨️ (0:05:29) Django Setup
⌨️ (0:06:31) Adding Docker Files
⌨️ (0:12:32) Connect Django with MySQL with Docker
⌨️ (0:19:12) Models & Serializers
⌨️ (0:23:11) Rest APIs with ViewSets
⌨️ (0:35:07) User Endpoint with APIView
⌨️ (0:37:53) Flask Setup with Docker
⌨️ (0:42:13) Connect Flask with Mysql
⌨️ (0:44:00) Models
⌨️ (0:47:41) Flask Migrations
⌨️ (0:51:44) RabbitMQ
⌨️ (0:52:15) Django Producer and Consumer
⌨️ (0:57:54) Flask Producer and Consumer
⌨️ (0:59:25) Queue Service
⌨️ (1:04:18) Data Consistency
⌨️ (1:14:36) Internal Http Requests
⌨️ (1:18:06) Finishing the python apps
⌨️ (1:25:51) React Setup
⌨️ (1:42:04) Products CRUD
⌨️ (2:08:44) Completing the Main App
⭐️ Special thanks to our Champion supporters! ⭐️
🏆 Loc Do
🏆 Joseph C
🏆 DeezMaster
--
Learn to code for free and get a developer job: www.freecodecamp.org
Read hundreds of articles on programming: freecodecamp.org/news
One of the best microservice tutorial in python till date....I have been waiting for any such tutorial for soo long....great work done...
Nice tutorial! I am just starting off with learning Python Microservices, and your demo is lucid. I like that you didn't cut off the mistakes part, correct it, and showcase it. The build-up is step-by-step so that we can follow you. Brilliant work!
Waiting for Microservices with Python course for some time. Glad it came out.
Same here.
came to learn about microservices, ended up with way way more valuable things. thanks man!
You gave me back hope to return to my college career in software engineering after 5 years with this real life demo of Docker!
I just love watching this Implementations and builds...POWERFUL.
Amazing tutorial by Scaling Scripts. Keep up the good work. I am learning a lot. One request, can future tutorials also show the best development practices used in enterprises. Like unit testing, how to organize the code etc. This will give a solid foundation. Just a suggestion. This end2end tutorial is awesome anyways.
I second this,
Waiting so long for this course.
Loved it..!!
This seems to be amazing video. I was looking exactly for this kind of material. Thank you!
One of the best microservice tutorial using python and reactjs
amazing content, not only microservices but a good docker tutorial within.
dota2 Pogchamp
Awesome tutorial with detailed coverage on each and every aspect of developing microservice. Easy to follow. Thanks buddy.
Doing this tutorial now is not only fulfilling having to google how the new packages are working because most logic has become obsolete. I have to stop and google around fixing libraries and get moving again. I have learnt a lot and thank you tutor for putting this together.
Some gaps are there for the learner to figure out and learn on their own, so don't let that be a frustration or a blocker.
Another thing, following the tutor into his confusion on why the unique constraints isn't working when he implemented product likes api, if you are keen you'll remember or go to that /users api in the other service and find he had randomized the api to return random user id which introduces a bug in his logic of using that api to implement like functionality.
Somewhere between Django setup and add Docker files our presenter completely missed a step. very frustrating. He goes to a screen/app he has not shown yet. Is that part of Docker? Is that something we need to have installed already? Is there a list of prerequisites?
Thank you for this amazing course! Could you please release another course with authentication for microservices using JWT?
Same here
always waiting for such a cool content ... appreciated this work byAnotonio
Thank you! This was indeed much needed
I wish my boss knows just a little bit of programming, especially CRUD operations. His motto is “You should make a website that even a child can also use”. He expects all CRUD to be done in one single page for a list of different fields that can all have CRUD operations. After I finished that project, I felt sick and satisfied at the same time.
Only technology people should deal with tech business. 😂These idiots make life hell..they can even ask to make a person alive after death by creating the some website
Very clean explanation! Thank you very much for that.
thank you so much... im working on a react project rn and this is soo helpful...
Exactly what I was looking for!!
Great job there Antonio !
Exactly what I was looking for! Thxs!
Going to go ahead and thumbs up now just based on the comment section.
Thank you ahead of time for this feast.
This video is really amazing. I would recommend for everyone.
This is crazy awesome! Thank you!
Great video... Your example is really nice!
Excellent video! Congratulations!
Anyone else having trouble connecting to the db at 19:10? I'm getting an error message saying "can't connect to MySQL server on db'
It is so great to have so much knowledge for free
Wow. just wow. understood so many things. thank you.
1:20:00 is the "docker.for.mac.localhost" name constant for everyone, or is this a user defined name for your docker instance?
In docker 20.10 is now 'host.docker.internal' , and doen not work in linux. In linux use the docker ip: 172.17.0.1 and add that IP to your allowed host on Django settings.pt, like this: ALLOWED_HOSTS = ['172.17.0.1']
@@ivan6navi Thank you very much!
You saved my sanity after realising choosing to develop this on Ubuntu was a mistake as there is not "docker.for.linux.localhost" equivalent. Changing the ALLOWED_HOSTS = ['172.17.0.1'] in admin\settings.py worked and Postman executed the def like() method like a charm! :D
@@ivan6navi Thanks! It worked on Linux
@Scalable Script Hello, when i use python manage.py migrate, it doesn't generate those tables in the video. Do you know how to fix that?
Thanks a lot 🙏🙏🙏.I wanted to learn micro services . I am a java developer
I'm having problems in the path, I try to retype de urls.py but the problem is circular imports or no data structure.
Wonderful & awesome. Thanks a billion times.
Great Tutorial, thank you.
How can I run that consumer.py file without docker and docker container?
Is it possible?
Implement this in normal django project with rest API without docker?
I came form java and spring and this tutorial was like a breeze, but please share the prerequisites like plugins and other stuff.
Why did you write the DB credentials in settings.py file when you wrote them as environment variables in the DockerCompose? Shouldn't we be reading them from the environment?
@scalable Scripts, thanks for the video. How about the Angular part?
So excited for this
I have a question.
Product model properties
- admin: id title image likes
- main: id title image
so, (2:11:45) we can't use "likes" because the product fetching by "localhost:8001/api/products" don't have "likes" properties.
why does it work?
I have the same question!
And because of that i don't get the like numbers shown in my main "localhost:3000/" page.... because main does not have "likes" properties.
can some tell me why it works in the video?
How are you updating the running apps to reflex your code changes? I don’t see you restarting anything when you edit code. Do you have some tool that automatically restarts (apps/containers?) on file changes?
See docker volume
I really liked. Thanks for share!
Which theme for pycharm are you using?
Hello, a question why I connect to the database and when consulting the database it does not bring me any table, it appears empty, but if you believe me and list me in the application?
can't run flask app in docker container
it works fine outside but can;t run it inside
the flask server starts in the container but i can't see a response on localhost
Do we have microservice packages similar to spring cloud in Python as well?
following this when I created products through dckr-cmps exec I got permissions denied when trying to overwrite models. I changed it to something like 644 and it work. I'm just curious about the security implications here, if I should have done it differently?
why did not use api manager to manage two different api sources?
why you use Flask ? you could complete the project with Django and Django Rest framework
Hi,
I am unable to resolve this error (@1:24:33)
"django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings."
In the video, he resolved the error by adding this line
"os.environ.setdefault("DJANGO_SETTINGS_MODULE", "admin.settings")
django.setup()"
However, this does not work for me. Any ideas on how to resolve this?
the resolution suggested in the video works - but only if you add it before the other import statement "from products.models import Product"; which means you would not have all your imports on the top of the file
how do you open a connection to the database in VS code? Is there an extension? If so which one is it?
this is PyCharm IDE
I use "mySQL" extension by cwijan . It explains in its description.
Install "Database Client" plugin
50:00 db migrations made and necessary files are added
Sorry and how do you demostrate microservices architecture here?:)
at 12:43 , that means that the db is running with docker? it's not an external server?
excellent, thank you very much!
Really in 2 hours all those topics? Oh my god, this will be interesting!
@15:30 on Windows I pulled MySQL into Docker Desktop but I am receiving the vague error "validating docker-compose.yml: services.backend Additional property db is not allowed", does anyone know how to fix this behaviour?
what are the prerequisites to start the tutorial?
very interesting tutorial, thanks
i didnt get the django connect with databse part. from whhere does that window popped up
@@ScalableScripts 😅 yeah I resolved it with MySQL extension in vscode
May I know how to change DB to progres SQL
Which IDE was used here?
Having an issue with React application not loading data at: 1:44:45 of the tutorial. Have not found a solution. Any direction would be greatly appreciated. Thanks. Receiving Cross-Origin Request Blocked and Uncaught (in promise TypeError: NetworkError when attempting to fetch resource.
docker-compose up , not running giving error no such file in directory
i dindn't get my requirements.txt installed after running docker-compose up can someone help me please
Hi,
Is this project work in python 3.8?
It's a good tutorial but I came to realize that it has a bit of coupling... when the django app goes down or when a message is sent and fails to reach the consumer in the flask app..the message might get lost and thus not updating the user table
I think it's part of the demonstration and made on purpose, otherwise all the communication would be done 100% via RabbitMQ
Why did we not create Publisher in flask app ? Am i missing something ?
while inspecting 1:44:49 i am getting error
its not able to get data
Failed to load resource: net::ERR_CONNECTION_REFUSED
Products.tsx:15 Uncaught (in promise) TypeError: Failed to fetch
Nice tutorial..but why don't you make two totally different services, like users and posts where by a sure has to be authenticated through jwt to create a post.
Wanted! this tutorial
Oh my god. I don't know the frontend can become so difficult now!
Those who are having problem with windows. Go to virus and threat protection and add the parent project folder into exclude list.
how can one deploy microservices like this on a server?
Is it possible to deploy this solution on AWS, GCP or any cloud PAAS?
yes easily
how do i access the Database in pycharm? at 16: 00, you said to connect to our ID but idk what you did to open that window
you need to download mysql, then when you run your docker container with database, you can connect to it using the mysql you downloaded
to connect use
mysql --port=33066 --user=root --password=root
im assuming that your mysql is added into PATH
@@2radix774 how do you connect it in vs code?
I am getting an error
so what I did is I took the whole project from Github and ran the docker file
its giving the index error
@@jayvadera9615 if you download mysql it is idependent of visual studio code, its a app that you run from cli
@@2radix774 were you able to run the whole project?
@@2radix774
while running the docker file its giving me this error
backend_1 | IndexError: list index out of range
queue_1 | IndexError: list index out of range
Sir plz make a video on how to build advance level zoom meeting clone using python from scratch
Thankyou "free code camp"
Hi getting error while connecting to mysql like in database navigator or cmd shows ssl error unsupported
ERROR 2026 (HY000): SSL connection error: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol
I heard ' I am your new papa for this tutorial ' 😆
I am trying this out but migrateCommand not working...kindly help
Hey, great course thank you!
I have one problem, I can't get the logs from the queue container in the main app to show the events of creation/updating/deleting a product. The db gets updated but I don't see the events and my print statements in the terminal. only db_1 and backend_1 logs. What can I do?
same issue here !
Had the same issue.
Make sure your ENV variable in the Dockerfile is called "PYTHONUNBUFFERED" and set to 1.
@@carloss1199 Gracias Carlos, me pasaba lo mismo! Thanks for your answer!
Around 31:44, what is the tool used for the test of post api?
postman. Web version is available.
You are boon to us❤️
bummed at 34:19 ! After I do an update, and do a PUT request, it's throwing gibberish. Basically assertion error. Expected a `Response`, `HttpResponse` or `HttpStreamingResponse` to be returned from the view, but received a ``
Any idea why?
There is product app inside admin project.
This admin is created using django.
Inside product app there is product model that maps with product table in main app.
This main app is created using flask.
----Operations---
Changes in product table in admin app should be reflected in product table in main app using rabbitmq.
Code is in views.py of product app in admin project.
Then the like operation over product is done from main app and the change is reflected over product table of admin app using (admin queue).
Code is in main.py of main app in main project.(Function name is "like")
Great but it needs some more explanation, not everything but at least you can talk about the mechanims how all those connect, maybe with diagrams.
is it possible to generate tokens Api in python?
Comments so I remember to watch this in the morning.
watch it
what is the tool used to connect the database at 16:02 ?
I think it’s the built in database explorer that comes with pycharm
Great tutorial.
Great video freeCodeCamp, just one thing. In Flask migrations the terminal throws me this:
Traceback (most recent call last):
File "manager.py", line 3, in
from flask_script import Manager
ModuleNotFoundError: No module named 'flask_script'
Can anyone help me please? :)
It's 2 months old, but in case you couldn't figure it out you might want to check the instalation of your pip packages, I was having a similar problem and turns out I had 2 python versions installed (3.8 and 3.9) and pip was installing the packages in the wrong place (3.8) so it was causing the "module not found" error
what ide he is using?
anyone tell me which tech stack he use I mean IDE and dependencies
18:32 how does django know that "db" will refer to our databse? i know thats how we called it in compose, but how is "db" converted into ip address?
It is converted by docker internal DNS
@@unixlike7968 thanks
It was a really great tutorial for Microservice using Python. Thanks!!!
are you currently studying to become a software engineer?
@@alexomaset5044 Actually I filled up my python skill to find a job. How about you?
@@mabeleain3320 thats nice, I am also currently searching for a job but I initially attended a bootcamp
Need to increase the font size or use the zoom feature of the screen capture or do both, so that we can easily see the code or the texts. Other freecodecamp videos do that but some just don't even bother to do it. It just add another layer of difficulty in the learning process when it's hard to see the code or the text.