Tuesday, May 31, 2022
HomeWordPress DevelopmentHow Django Works - DEV Neighborhood

How Django Works – DEV Neighborhood


Image description

Earlier than we create our first Django internet app, let’s take just a little look into how Django works beneath the hood. The Django venture describes itself as an MTV framework, utilizing Fashions, Templates and Views. Let’s break down these parts:

  1. The mannequin portion offers with information and databases, it will possibly retrieve, retailer, and alter information in a database.
  2. The template determines how the info seems to be on an online web page.
  3. The view describes the info to be offered, and passes this info to the template.

With the fundamentals of the parts defined let’s perceive how they work collectively after we go to a Django web site. When a request involves an online server, it’s handed to Django to determine what’s requested. A consumer requests a URL, let’s use codecademy.com for instance, Django will take the net deal with and move it to its urlresolver. Django will attempt to match the URL to an inventory of patterns, and if there’s a match, then move the request to the related view operate.

Think about a mail service delivering a letter. They stroll down the road checking every home quantity till they discover the precise one on the letter. As soon as they discover the home, they ship the letter. That’s how the urlresolver works!

Once we land on the precise web page, Django makes use of information from the mannequin and feeds it into the view operate to find out what information is proven. That information is given to the template and offered to us through the net web page.

It is a little bit of a simplified model of what Django is doing beneath the hood, however a key takeaway is that Django follows this MTV sample.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments