Django
Django
Django
Django is a Python framework that makes it easier to create web sites using
Python.
Django takes care of the difficult stuff so that you can concentrate on building
your web applications.
Model - The data you want to present, usually data from a database.
View - A request handler that returns the relevant template and content -
based on the request from the user.
Template - A text file (like an HTML file) containing the layout of the web
page, with logic on how to display the data.
Model
The model provides data from the database.
The most common way to extract data from a database is SQL. One problem
with SQL is that you have to have a pretty good understanding of the database
structure to be able to work with it.
Django, with ORM, makes it easier to communicate with the database, without
having to write complex SQL statements.
View
A view is a function or method that takes http requests as arguments, imports
the relevant model(s), and finds out what data to send to the template, and
returns the final result.
Template
A template is a file where you describe how the result should be represented.
Templates are often .html files, with HTML code describing the layout of a web
page, but it can also be in other file formats to present other results, but we will
concentrate on .html files.
Django uses standard HTML to describe the layout, but uses Django tags to add
logic: