INTRODUCTION ABOUT DJANGO-PYTHON WEB FRAMEWORK
What is Django:
Django is a popular python-based backend framework, and it is used for web
development. It is a high-level web framework that allows building secure and
maintainable websites quickly.
Django is a free and open-source framework, which
means it is free to use.
Django also
follows Model-View-Controller (MVC) architecture, which is now the
standard for web application development.
Django emphasizes reusability of components, also referred
to as DRY (Don't Repeat Yourself), and comes with ready-to-use features like
login system, database connection and CRUD operations (Create Read Update
Delete).
Django is especially helpful for database driven
websites.
What is a web framework:
Web framework is a Collection of modules, packages
and libraries designed to speedup the development.
History of Django:
Django was created in the year 2003 by Adrian
Holovaty and Simon Willison when they started using Python to develop a web
application.
It was released in July 2005 under the BSD license
and was named after the guitarist Django Reinhardt.
In the year 2008, a foundation named Django Software
Foundation (DSF) was established to maintain Django.
Django Architecture
Django follows its own convention of
Model-View-Controller (MVC) architecture named Model View Template (MVT). The
MVT is a software design pattern that mainly consists of 3 components Model,
View, and Template.
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.
In Django, the data is delivered as an Object
Relational Mapping (ORM), which is a technique designed to make it easier to
work with databases.
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.
The models are usually located in a file
called models.py.
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.
The views are usually located in a file
called views.py.
Templates:
A template is a file where you describe how the
result should be represented.
Templates are often .html files,but it can also be
in other file formats to present other results.
Django uses standard HTML to describe the layout,
but uses Django tags to add logic
The templates of an application is located in a
folder named templates.
Urls:
Django also provide a way to navigate around the
different pages in a website.
When a user requests a URL, Django decides
which view it will send it to.
This is done in a file called urls.py.
How Django Works:
When you have installed Django and created you first
Django web application, and the browser requests the URL, this is basically
what happens:
- Django receives the URL, checks the urls.py file, and calls the view that matches the URL.
- The view, located in views.py, checks for relevant models.
- The models are imported from the models.py file.
- The view then sends the data to a specified template in the template folder.
- The template contains HTML and Django tags, and with the data it returns finished HTML content back to the browser.
Features of Django:
Open-Source– Django is an open-source python
framework, which means we can download and use it for free. This helps to reduce
the overall cost of the application.
Fast Development– Django was designed with the goal
of creating a framework that would allow developers to develop web applications
in less time. So, Django reduces the project implementation, allowing rapid web
development.
Scalable– Django is scalable in nature, which means
we can easily migrate from a small-scale application to a large-scale
application.
Secure– Django is a secure framework as it provides
tools to assist developers to avoid typical security problems. It also provides
an authentication system to store manage user accounts and passwords.
Largely supported libraries– Django contains a large
set of modules and libraries that can be used to manage different web
development tasks.
Admin Interface– Django comes with a build-in admin
interface. So, we don’t need to build it from the scratch. Also, we can
customize the interface according to the requirements.
Large Community– As Django is one of the most
popular web development framework. So, it has a large and friendly community as
well as channels for sharing and connecting.
Companies Using Django:
Django is simple and easy to use, additionally, it
offers so many things which make it a perfect framework for any type of web
application. Django is so efficient that some of the big companies are also
using it for their web application. Here are some of the companies which use
Django.
- Spotify
- Mozilla
- National Geographic
- Bitbucket
- Eventbrite
Comments
Post a Comment