SlideShare a Scribd company logo
9
Most read
11
Most read
12
Most read
D.J.A.N.G.O
Kalim Ullah
Introduction
Django is a high-level Python web framework that enables rapid development
of secure and maintainable websites. Built by experienced developers, Django
takes care of much of the hassle of web development, so you can focus on
writing your app without needing to reinvent the wheel. It is free and open
source, has a thriving and active community, great documentation, and
many options for free and paid-for support.
Installation
 Installation guide https://github.com/mangrio123/Python-Django-Setup-
Guide
PIP
 Django requires pip to start installation.
 Pip is a package manager system which is used to install and manage packages
written in python.
 For Python 3.4 and higher versions pip3 is used to manage packages.
Virtual Environment
 The virtual environment is an environment which is used by Django to
execute an application.
 It is recommended to create and execute a Django application in a separate
environment.
 Python provides a tool virtualenv to create an isolated Python environment
Admin Interface
 Django provides a built-in admin module which can be used to perform CRUD
operations on the models.
 It reads metadata from the model to provide a quick interface where the user
can manage the content of the application.
 This is a built-in module and designed to perform admin related tasks to the
user.
 Let's see how to activate and use Django's admin module (interface).
Django App
 Django application consists of project and app, it also generates an automatic
base directory for the app, so we can focus on writing code (business logic)
rather than creating app directories.
 The difference between a project and app is, a project is a collection of
configuration files and apps whereas the app is a web application which is
written to perform business logic.
Django MVT
 The MVT (Model View Template) is a software design pattern. It is a collection
of three important components Model View and Template.
 M - The Model helps to handle database. It is a data access layer which
handles the data.
 V- The View is used to execute the business logic and interact with a model to
carry data and renders a template.
 T- The Template is a presentation layer which handles User Interface part
completely.
 Although Django follows MVC pattern but maintains its own conventions. So,
control is handled by the framework itself.
URLs/Routes
 Since Django is a web application framework, it gets user requests by URL
locater and responds back.
 To handle URL, django.urls module is used by the framework.
Middleware
 In Django, middleware is a lightweight plugin that processes during request
and response execution.
 Middleware is used to perform a function in the application. The functions
can be a security, session, csrf protection, authentication etc.
 Django provides various built-in middleware and also allows us to write our
own middleware.
 See, settings.py file of Django project that contains various middleware, that
is used to provides functionalities to the application.
Static Files Handling
 Apart from business logic and data handling, we also need to handle and
manage static resources like CSS, JavaScript, images etc.
 Django deals with it very efficiently and provides a convenient manner to use
resources.
 Include the django.contrib.staticfiles in INSTALLED_APPS.
 Define STATIC_URL in settings.py file as given below.
 Load static files in the templates by using the below expression.
Database Migrations
 Migration is a way of applying changes that we have made to a model, into
the database schema.
 Django creates a migration file inside the migration folder for each model to
create the table schema, and each table is mapped to the model of which
migration is created.
 Django provides the various commands that are used to perform migration
related tasks. After creating a model, we can use these commands.
 makemigrations : It is used to create a migration file that contains code for the
tabled schema of a model.
 migrate : It creates table according to the schema defined in the migration file.
 sqlmigrate : It is used to show a raw SQL query of the applied migration.
 showmigrations : It lists out all the migrations and their status.
Model Form
 It is a class which is used to create an HTML form by using the Model.
 It is an efficient way to create a form without writing HTML code.
 Django automatically does it for us to reduce the application development
time.
 For example, suppose we have a model containing various fields, we don't
need to repeat the fields in the form file.
 For this reason, Django provides a helper class which allows us to create a
Form class from a Django model.
Django Forms
 Django provides a Form class which is used to create HTML forms. It describes
a form and how it works and appears.
 It is similar to the ModelForm class that creates a form by using the Model,
but it does not require the Model.
 Each field of the form class map to the HTML form <input> element and each
one is a class itself, it manages form data and performs validation while
submitting the form.

More Related Content

PPT
Introduction To Django
Jay Graves
 
KEY
Introduction to Django
James Casey
 
PPTX
Web development with django - Basics Presentation
Shrinath Shenoy
 
PDF
Django Introduction & Tutorial
之宇 趙
 
ODP
Django for Beginners
Jason Davies
 
PDF
Django Tutorial | Django Web Development With Python | Django Training and Ce...
Edureka!
 
PDF
NodeJS for Beginner
Apaichon Punopas
 
PPTX
Django Girls Tutorial
Kishimi Ibrahim Ishaq
 
Introduction To Django
Jay Graves
 
Introduction to Django
James Casey
 
Web development with django - Basics Presentation
Shrinath Shenoy
 
Django Introduction & Tutorial
之宇 趙
 
Django for Beginners
Jason Davies
 
Django Tutorial | Django Web Development With Python | Django Training and Ce...
Edureka!
 
NodeJS for Beginner
Apaichon Punopas
 
Django Girls Tutorial
Kishimi Ibrahim Ishaq
 

What's hot (20)

PDF
Introduction to django
Ilian Iliev
 
PDF
TypeScript - An Introduction
NexThoughts Technologies
 
PPTX
Basic Concept of Node.js & NPM
Bhargav Anadkat
 
PPTX
Django Framework Overview forNon-Python Developers
Rosario Renga
 
PDF
Django로 쇼핑몰 만들자
Kyoung Up Jung
 
PPTX
Introduction to Django
Knoldus Inc.
 
PDF
MEAN Stack
Krishnaprasad k
 
PPTX
Laravel Tutorial PPT
Piyush Aggarwal
 
PPTX
Introduction to Django Rest Framework
bangaloredjangousergroup
 
PPT
Django, What is it, Why is it cool?
Tom Brander
 
PPTX
Express js
Manav Prasad
 
PPTX
Web api
Sudhakar Sharma
 
PDF
Python Django tutorial | Getting Started With Django | Web Development With D...
Edureka!
 
PPTX
Python-Classes.pptx
Karudaiyar Ganapathy
 
PPTX
Introduction Node.js
Erik van Appeldoorn
 
PPTX
Flask – Python
Max Claus Nunes
 
PDF
Nodejs presentation
Arvind Devaraj
 
PPT
Introduction to Android Fragments
Sergi Martínez
 
PPTX
Introduction to Django
Ahmed Salama
 
Introduction to django
Ilian Iliev
 
TypeScript - An Introduction
NexThoughts Technologies
 
Basic Concept of Node.js & NPM
Bhargav Anadkat
 
Django Framework Overview forNon-Python Developers
Rosario Renga
 
Django로 쇼핑몰 만들자
Kyoung Up Jung
 
Introduction to Django
Knoldus Inc.
 
MEAN Stack
Krishnaprasad k
 
Laravel Tutorial PPT
Piyush Aggarwal
 
Introduction to Django Rest Framework
bangaloredjangousergroup
 
Django, What is it, Why is it cool?
Tom Brander
 
Express js
Manav Prasad
 
Python Django tutorial | Getting Started With Django | Web Development With D...
Edureka!
 
Python-Classes.pptx
Karudaiyar Ganapathy
 
Introduction Node.js
Erik van Appeldoorn
 
Flask – Python
Max Claus Nunes
 
Nodejs presentation
Arvind Devaraj
 
Introduction to Android Fragments
Sergi Martínez
 
Introduction to Django
Ahmed Salama
 
Ad

Similar to Basic Python Django (20)

PDF
Django Workflow and Architecture
Andolasoft Inc
 
PDF
Web development django.pdf
KomalSaini178773
 
PDF
Django
sisibeibei
 
PPTX
Django Framework Interview Question and Answer partOne.pptx
Md. Naimur Rahman
 
PDF
Django Documentation
Ying wei (Joe) Chou
 
PPTX
Django course
Nagi Annapureddy
 
PPTX
Introduction to DJANGO, a creative framework
bunnybro2953
 
PPTX
Django Framework Interview Guide - Part 1
To Sum It Up
 
PPTX
Tango with django
Rajan Kumar Upadhyay
 
PPTX
Django Architecture Introduction
Haiqi Chen
 
PPTX
1-_Introduction_To_Django_Model_and_Database (1).pptx
TamilGamers4
 
PPTX
Why Django for Web Development
Morteza Zohoori Shoar
 
PDF
Rapid web application development using django - Part (1)
Nishant Soni
 
PDF
GDG Addis - An Introduction to Django and App Engine
Yared Ayalew
 
DOCX
Akash rajguru project report sem v
Akash Rajguru
 
PPTX
Advanced Web Technology using Django.pptx
smartguykrish11
 
PPTX
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Udit Gangwani
 
PDF
django_introduction20141030
Kevin Wu
 
PDF
Django in Action (MEAP V01) Christopher Trudeau
dsmplwegv4530
 
Django Workflow and Architecture
Andolasoft Inc
 
Web development django.pdf
KomalSaini178773
 
Django
sisibeibei
 
Django Framework Interview Question and Answer partOne.pptx
Md. Naimur Rahman
 
Django Documentation
Ying wei (Joe) Chou
 
Django course
Nagi Annapureddy
 
Introduction to DJANGO, a creative framework
bunnybro2953
 
Django Framework Interview Guide - Part 1
To Sum It Up
 
Tango with django
Rajan Kumar Upadhyay
 
Django Architecture Introduction
Haiqi Chen
 
1-_Introduction_To_Django_Model_and_Database (1).pptx
TamilGamers4
 
Why Django for Web Development
Morteza Zohoori Shoar
 
Rapid web application development using django - Part (1)
Nishant Soni
 
GDG Addis - An Introduction to Django and App Engine
Yared Ayalew
 
Akash rajguru project report sem v
Akash Rajguru
 
Advanced Web Technology using Django.pptx
smartguykrish11
 
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Udit Gangwani
 
django_introduction20141030
Kevin Wu
 
Django in Action (MEAP V01) Christopher Trudeau
dsmplwegv4530
 
Ad

Recently uploaded (20)

PDF
Teaching Reproducibility and Embracing Variability: From Floating-Point Exper...
University of Rennes, INSA Rennes, Inria/IRISA, CNRS
 
PDF
Exploring AI Agents in Process Industries
amoreira6
 
PPTX
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
PPTX
Presentation of Computer CLASS 2 .pptx
darshilchaudhary558
 
PDF
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
PDF
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Hironori Washizaki
 
PDF
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
PDF
Become an Agentblazer Champion Challenge Kickoff
Dele Amefo
 
PPTX
Why Use Open Source Reporting Tools for Business Intelligence.pptx
Varsha Nayak
 
PPTX
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
PDF
Solar Panel Installation Guide – Step By Step Process 2025.pdf
CRMLeaf
 
DOCX
The Five Best AI Cover Tools in 2025.docx
aivoicelabofficial
 
PDF
Become an Agentblazer Champion Challenge
Dele Amefo
 
PPTX
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
Why Use Open Source Reporting Tools for Business Intelligence.pdf
Varsha Nayak
 
PPTX
TestNG for Java Testing and Automation testing
ssuser0213cb
 
PDF
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
Q-Advise
 
PDF
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
PDF
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pdf
Certivo Inc
 
Teaching Reproducibility and Embracing Variability: From Floating-Point Exper...
University of Rennes, INSA Rennes, Inria/IRISA, CNRS
 
Exploring AI Agents in Process Industries
amoreira6
 
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
Presentation of Computer CLASS 2 .pptx
darshilchaudhary558
 
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Hironori Washizaki
 
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
Become an Agentblazer Champion Challenge Kickoff
Dele Amefo
 
Why Use Open Source Reporting Tools for Business Intelligence.pptx
Varsha Nayak
 
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
Solar Panel Installation Guide – Step By Step Process 2025.pdf
CRMLeaf
 
The Five Best AI Cover Tools in 2025.docx
aivoicelabofficial
 
Become an Agentblazer Champion Challenge
Dele Amefo
 
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Why Use Open Source Reporting Tools for Business Intelligence.pdf
Varsha Nayak
 
TestNG for Java Testing and Automation testing
ssuser0213cb
 
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
Q-Advise
 
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pdf
Certivo Inc
 

Basic Python Django

  • 2. Introduction Django is a high-level Python web framework that enables rapid development of secure and maintainable websites. Built by experienced developers, Django takes care of much of the hassle of web development, so you can focus on writing your app without needing to reinvent the wheel. It is free and open source, has a thriving and active community, great documentation, and many options for free and paid-for support.
  • 3. Installation  Installation guide https://github.com/mangrio123/Python-Django-Setup- Guide
  • 4. PIP  Django requires pip to start installation.  Pip is a package manager system which is used to install and manage packages written in python.  For Python 3.4 and higher versions pip3 is used to manage packages.
  • 5. Virtual Environment  The virtual environment is an environment which is used by Django to execute an application.  It is recommended to create and execute a Django application in a separate environment.  Python provides a tool virtualenv to create an isolated Python environment
  • 6. Admin Interface  Django provides a built-in admin module which can be used to perform CRUD operations on the models.  It reads metadata from the model to provide a quick interface where the user can manage the content of the application.  This is a built-in module and designed to perform admin related tasks to the user.  Let's see how to activate and use Django's admin module (interface).
  • 7. Django App  Django application consists of project and app, it also generates an automatic base directory for the app, so we can focus on writing code (business logic) rather than creating app directories.  The difference between a project and app is, a project is a collection of configuration files and apps whereas the app is a web application which is written to perform business logic.
  • 8. Django MVT  The MVT (Model View Template) is a software design pattern. It is a collection of three important components Model View and Template.  M - The Model helps to handle database. It is a data access layer which handles the data.  V- The View is used to execute the business logic and interact with a model to carry data and renders a template.  T- The Template is a presentation layer which handles User Interface part completely.  Although Django follows MVC pattern but maintains its own conventions. So, control is handled by the framework itself.
  • 9. URLs/Routes  Since Django is a web application framework, it gets user requests by URL locater and responds back.  To handle URL, django.urls module is used by the framework.
  • 10. Middleware  In Django, middleware is a lightweight plugin that processes during request and response execution.  Middleware is used to perform a function in the application. The functions can be a security, session, csrf protection, authentication etc.  Django provides various built-in middleware and also allows us to write our own middleware.  See, settings.py file of Django project that contains various middleware, that is used to provides functionalities to the application.
  • 11. Static Files Handling  Apart from business logic and data handling, we also need to handle and manage static resources like CSS, JavaScript, images etc.  Django deals with it very efficiently and provides a convenient manner to use resources.  Include the django.contrib.staticfiles in INSTALLED_APPS.  Define STATIC_URL in settings.py file as given below.  Load static files in the templates by using the below expression.
  • 12. Database Migrations  Migration is a way of applying changes that we have made to a model, into the database schema.  Django creates a migration file inside the migration folder for each model to create the table schema, and each table is mapped to the model of which migration is created.  Django provides the various commands that are used to perform migration related tasks. After creating a model, we can use these commands.  makemigrations : It is used to create a migration file that contains code for the tabled schema of a model.  migrate : It creates table according to the schema defined in the migration file.  sqlmigrate : It is used to show a raw SQL query of the applied migration.  showmigrations : It lists out all the migrations and their status.
  • 13. Model Form  It is a class which is used to create an HTML form by using the Model.  It is an efficient way to create a form without writing HTML code.  Django automatically does it for us to reduce the application development time.  For example, suppose we have a model containing various fields, we don't need to repeat the fields in the form file.  For this reason, Django provides a helper class which allows us to create a Form class from a Django model.
  • 14. Django Forms  Django provides a Form class which is used to create HTML forms. It describes a form and how it works and appears.  It is similar to the ModelForm class that creates a form by using the Model, but it does not require the Model.  Each field of the form class map to the HTML form <input> element and each one is a class itself, it manages form data and performs validation while submitting the form.