Django: Getting Started Transcripts
Chapter: Deploying Django Webapps
Lecture: Parts of a web page are served differently

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's walk through what happens when you use the web to interact with a Django project. First you type in a URL in your browser.
0:11 Your browser looks at the host name and ports part of the URL to figure out what server to talk to.
0:18 The web server answers the call and inspects the URL. It looks at its configuration and maps that URL to a server.
0:27 In our case, this is the WSGI service which further maps to Django. Django then examines the same URL and uses the project's URLs file to find a view.
0:39 That view gets called and results in the rendering of a template. Returning some HTML.
0:48 The HTML is received by the browser and the browser's rendering begins. Within that HTML there might be a reference to some static content.
0:58 The same process repeats going back to the server, this time with the URL of the site's CSS files.
1:07 Common configuration is for the web server to host the static content itself. That means no need to talk to WSGI and Django.
1:16 Through the server's own configuration the URL is mapped to a directory and then the static files are served from there.
1:22 If that served file is a style sheet, then the content in it return to the browser, helps it further render the HTML by giving it style information.
1:33 Even later in this sample HTML is a reference to the user's avatar, wash rinse and repeat the URL goes up to the server.
1:43 These are media files uploaded by the user. Typically these are still handled by the web server itself.
1:50 The server then sends the binary content of the image back to the browser so that
1:55 it can be rendered, who knew so much was going on just to get a simple page going.

Talk Python's Mastodon Michael Kennedy's Mastodon