0% found this document useful (0 votes)
5 views3 pages

Django

Django is a Python web framework that follows the Model-View-Template (MVT) pattern, which differs from the traditional Model-View-Controller (MVC) pattern by having Django manage the Controller aspect. The MVT pattern consists of Models for data structure, Views for request handling, and Templates for formatting responses. Installing Django is straightforward and platform-independent, with the latest version available for download from the official website.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Django

Django is a Python web framework that follows the Model-View-Template (MVT) pattern, which differs from the traditional Model-View-Controller (MVC) pattern by having Django manage the Controller aspect. The MVT pattern consists of Models for data structure, Views for request handling, and Templates for formatting responses. Installing Django is straightforward and platform-independent, with the latest version available for download from the official website.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

DJANGO:

As you already know, Django is a Python web framework. And like


most modern framework, Django supports the MVC pattern. First let's
see what is the Model-View-Controller (MVC) pattern, and then we will
look at Django’s specificity for the Model-View-Template (MVT)
pattern.

MVC Pattern:
When talking about applications that provides UI (web or
desktop), we usually talk about MVC architecture. And as the name
suggests, MVC pattern is based on three components: Model, View, and
Controller.

DJANGO MVC - MVT Pattern:


The Model-View-Template (MVT) is slightly different from MVC. In
fact the main difference between the two patterns is that Django itself
takes care of the Controller part (Software Code that controls the
interactions between the Model and View), leaving us with the template.
The template is a HTML file mixed with Django Template Language
(DTL).

The following diagram illustrates how each of the components of the


MVT pattern interacts with each other to serve a user request −
The developer provides the Model, the view and the template then just
maps it to a URL and Django does the magic to serve it to the user.
Django development environment consists of installing and setting up
Python, Django, and a Database System. Since Django deals with web
application, it's worth mentioning that you would need a web server
setup as well.
 URLs: While it is possible to process requests from every single
URL via a single function, it is much more maintainable to write a
separate view function to handle each resource. A URL mapper is
used to redirect HTTP requests to the appropriate view based on the
request URL. The URL mapper can also match particular patterns
of strings or digits that appear in a URL and pass these to a view
function as data.
 View: A view is a request handler function, which receives HTTP
requests and returns HTTP responses. Views access the data
needed to satisfy requests via models, and delegate the formatting
of the response to templates.
 Models: Models are Python objects that define the structure of
an application's data, and provide mechanisms to manage (add,
modify, delete) and query records in the database.
 Templates: A template is a text file defining the structure or layout
of a file (such as an HTML page), with placeholders used to
represent actual content. A view can dynamically create an HTML
page using an HTML template, populating it with data from
a model. A template can be used to define the structure of any type
of file; it doesn't have to be HTML!

Installing Django:
Installing Django is very easy, but the steps required for its
installation depends on your operating system. Since Python is a
platform-independent language, Django has one package that works
everywhere regardless of your operating system.

You can download the latest version of Django from the


link http://www.djangoproject.com/download

You might also like