In this lesson, you’ll walk through the flow of a request through a Django app. You’re going to see what happens when you type an address into your web browser and press Enter.
The first address point inside the Django app is the
urls.py in the management app. That file will direct you towards the
urls.py in the app you want to go to. That will forward you to
views.py, where the code logic happens. The functions in there will direct you towards a specific template to render and return to the user to see in the browser.
Now, when you’re in your web browser and you type something in there, this is going to be the address of our
localhost app. Remember, here on the right, this is the file structure that we just looked at before.
The next thing that happens is that the first address point for inside the Django app is going to be this
urls.py. The project-level management app
urls.py that’s defined inside of
settings—this is the first one to look at, and it directs us forward to the
urls.py inside of our app.
This one, again, forwards us to
views.py, where the code logic happens and the functions in here direct us to a specific template that’s going to get rendered and finally returned back to the user to see in the browser. All right, so, what happens if we change the URL up there?
Let’s say we want to see a specific project, so I’m typing
1 in here. And again, it goes through the same steps in the process.
views.py, into the
templates/, and then the template gets rendered and shown to us, the user on the front end.
01:33 There’s a little bit more to this whole process, and we’re going to dive deeper into it, but just so that you have kind of a connection between what’s happening in the browser and this file structure that we looked at before.
01:46 So, that’s all for a quick overview of the flow inside of a Django project. In the next video, we’re going to do a quick recap of what we talked about in this section of the course, and then we’re going to move on. So, see you in the next video!
Become a Member to join the conversation.