#100DaysOfWeb in Python Transcripts
Chapter: Days 97-100: Docker and Docker Compose
Lecture: Using the local services container
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
We saw once we got our docker container working, it was out talking to movie_svc.talkpython.fm, and that's cool
0:08
but what we're trying to model is a frontend talking to a backend within two containers because that kind of represents most web apps
0:16
most deployments, you can factor out from there. So, let's go real quickly and change our frontend code here, over in this
0:27
this is in the javascript bit, where instead of going like this, let's just put this as local host and let's put it on port 7007.
0:37
Why that? Well, over in this character here that's what we have right there, okay? So the idea is that we want to run this service
0:49
and then talk to it, so let's see how that goes. I come over here and I say run this notice all the data is gone, right
1:00
the page loaded up but we're not giving to the service. And that's because it's not running. Let's real quickly add a virtual environment here.
1:23
Okay, so we have a new virtual environment and let's just make sure it's active it looks like it is, perfect.
1:31
And then we need to run the requirements to get started. Great, so it looks like those installed and now I should be able to just run the app
1:45
and see what we get. Super, it's running. Now if we just go back and refresh this, tada! It's working, and you can see it's working
1:55
because right there, it's going back to our service. So now we have this using our local host, 7007 data
2:04
and it looks like it's working again, just as it should. The test is working, okay. So that's great when we run it here
2:13
but if we don't have it running again it's broken, right? Our goal is to make this, we got our frontend bits
2:20
running, the next goal is to run the movie service in its own docker container and have those two communicate. That'd be a little bit more challenging
2:28
because as you saw, we have to do things like install pip install the requirements, and that sort of stuff.