Presentation Aman Django
Presentation Aman Django
TITLE
Affiliation Arya
Authorized by Presented by
College of
Aman Mishra Aman Mishra
engineering and IT
INTRODUCTION TO DJANGO
• Django is a Python-based web framework which allows you to quickly create web
application without all of the installation or dependency problems that you normally
will find with other frameworks. Django uses MVT design pattern.
• The MVT stands for Model View Template.
• • It is a software design pattern.
• • It is a collection of three important components Model, View and Template.
• • Model helps to handle database.
• • The Template is a presentation layer which handles user interface part.(jinja 2 engine
is used).
• • The view is used to execute business logic and interact with a model to carry data
and renders a template(HTML , CSS is used).
When you’re building a website, you always need a similar set of components: a way
to handle user authentication (signing up, signing in, signing out), a management panel
for your website, forms, a way to upload files, etc. Django gives you ready-made
components to use.
TEMPLATE
Django provides a convenient way to generate dynamic HTML pages by using its
template system •
A template consists of static parts of the desired HTML output as well as some
special syntax describing how dynamic content will be inserted
• Django template engine is used to separate the design from the python code and
allows us to build dynamic pages.
templates are HTML files.
VIEWS
A view function, or view is simply a Python function that takes a Web
request and returns a Web response. This response can be the HTML
contents of a Web page, or a redirect, or a 404 error, or an XML
document, or an image or anything, really. The view itself contains
whatever arbitrary logic is necessary to return that response.
The business logic is put in a file called views.py, placed in your
project or application directory.
There are two type of views in Django:-
Function based views
Class based views
MODEL
manage.py-This file is used to interact with your project via command line(start the
server, sync the database etc).
folder –This folder contains all the packages of your project. Initially it contains four files –
1. _init_.py – It is python package.
2. settings.py – As the name indicates it contains all the website settings. In this file we
register any applications we create, the location of our static files, database configuration
details, etc.
3. urls.py – In this file we store all links of the project and functions to call.
4. wsgi.py – It is stands for web server gateway interface,This file is used in deploying the
project in WSGI. It is used to help your Django application communicate with the web
server.
Django Client-Server Architecture
• Client sends request by writing url on the browser. Sometimes optional data can also be
sent with the request. Such request is known as Http Request.
• When Django receives client’s request it first job is to find action to be taken against
requested url. Urls.py is the file where url patterns are mapped with the actions. These
actions are usually python functions. These python functions are defined in views.py file of
some app of your project.
• Django then invokes the found action (python function from views.py).
• This view function performs the business logic. Sometimes, it requests data access which
is either stored in the database or to be stored in the database. Model concept provides an
ease to the programmer to access database without bothering SQL commands.
• Model provides a python way to interact with the database.
• At last python function uses templates to return the final response.
• View returns the response to Django and Django send it to the browser which is known
as http response.
Create views
FUTURE SCOPE OF DJANGO
Python
Python is a renowned programming language that has been in the
industry for more than 25 years. Since its inception, it has gone many
updates and improvisations. Hence, Python is one of the fastest growing
programming languages in the world.
What is the main reason why python is on the top? – Because of its
regular improvisation and easy to use language in the world.
• Django is a powerful open source framework that was
released initially in 2005. Factors such as simplicity, reliability, and
scalability have primarily contributed to its growth over the past
years. For these reasons, it has evolved to be one of the go-to
options for developers and businesses worldwide.