How Django Handles HTTP Request and HTTP Response
To describe Django's role in web applications, it is crucial to know the basics of HTTP requests and HTTP responses. HTTP is a communication protocol used for websites or web applications.
The basic flow of browsing websites
The basic flow of browsing websites (without dynamic components) can be described in two simple steps.
Step 1: When a user clicks on a link or button in a web browser, the browser sends an HTTP request (URL) to a web server located at the address specified by the URL.
Step 2: The web server sends an HTTP response (requested resources such as HTML, CSS, and image files) to the browser, and the browser renders the data on the display.
How is a Django application involved in the HTTP request and response process?
If a user accesses Django-based web applications, there will be one more step between HTTP request and HTTP response.
Step 1.5 (between Step 1 and 2):
Once the web server receives an HTTP request, the web server passes the HTTP request to the Django application, and the Django application processes the request. Depending on the HTTP request, Django generates a tailored HTTP response and sends it back to the web server.
Thus, designing a Django web application is about designing processes that are used when the Django application receives HTTP requests and creates HTTP responses.