SlideShare a Scribd company logo
5
Most read
8
Most read
9
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

PDF
Django Tutorial | Django Web Development With Python | Django Training and Ce...
PPTX
Django Seminar
PDF
Introduction to django framework
PDF
Web Development with Python and Django
PDF
Flutter Tutorial For Beginners | Edureka
PPTX
Flutter presentation.pptx
PDF
Python Programming Tutorial | Edureka
PPTX
Django Tutorial | Django Web Development With Python | Django Training and Ce...
Django Seminar
Introduction to django framework
Web Development with Python and Django
Flutter Tutorial For Beginners | Edureka
Flutter presentation.pptx
Python Programming Tutorial | Edureka

What's hot (20)

PPTX
Introduction to Node.js
PPTX
Introduction to Django
PPTX
Python - Numpy/Pandas/Matplot Machine Learning Libraries
PDF
A Basic Django Introduction
PPTX
Python Libraries and Modules
PDF
LangChain Intro by KeyMate.AI
KEY
Web application development with Django framework
PPTX
Google Firebase
PPTX
Object oriented programming in python
PDF
What is Python? | Edureka
PPTX
Beginning Python Programming
PPTX
Laravel ppt
PDF
Python libraries
PPTX
Ontology development in protégé-آنتولوژی در پروتوغه
PDF
Django Introduction & Tutorial
PPTX
Basics of Object Oriented Programming in Python
PPT
Introduction To Django
PPTX
Flutter workshop
PPTX
Django Girls Tutorial
ODP
The Full Stack Web Development
Introduction to Node.js
Introduction to Django
Python - Numpy/Pandas/Matplot Machine Learning Libraries
A Basic Django Introduction
Python Libraries and Modules
LangChain Intro by KeyMate.AI
Web application development with Django framework
Google Firebase
Object oriented programming in python
What is Python? | Edureka
Beginning Python Programming
Laravel ppt
Python libraries
Ontology development in protégé-آنتولوژی در پروتوغه
Django Introduction & Tutorial
Basics of Object Oriented Programming in Python
Introduction To Django
Flutter workshop
Django Girls Tutorial
The Full Stack Web Development
Ad

Similar to Basic Python Django (20)

PDF
Django Workflow and Architecture
PPTX
Django framework
DOCX
Company Visitor Management System Report.docx
PDF
Rapid web application development using django - Part (1)
PDF
Step-by-Step Django Web Development with Python
PDF
Learn Django Tips, Tricks & Techniques for Developers
PDF
Integrating Machine Learning with Django: A Practical Guide
PPTX
PPTX
Django Framework Interview Guide - Part 1
PPTX
PPTX
Django Framework Overview forNon-Python Developers
PPTX
PPTX
Introduction to Django
PDF
Database Website on Django
PPTX
Unleash-the-power-of-Django.pptx
PPTX
Django Introdcution
PPTX
Introduction to DJANGO, a creative framework
DOCX
What is Full Stack with Django and how to start learning It.docx
DOCX
What are the basic key points to focus on while learning Full-stack web devel...
Django Workflow and Architecture
Django framework
Company Visitor Management System Report.docx
Rapid web application development using django - Part (1)
Step-by-Step Django Web Development with Python
Learn Django Tips, Tricks & Techniques for Developers
Integrating Machine Learning with Django: A Practical Guide
Django Framework Interview Guide - Part 1
Django Framework Overview forNon-Python Developers
Introduction to Django
Database Website on Django
Unleash-the-power-of-Django.pptx
Django Introdcution
Introduction to DJANGO, a creative framework
What is Full Stack with Django and how to start learning It.docx
What are the basic key points to focus on while learning Full-stack web devel...
Ad

Recently uploaded (20)

PDF
medical staffing services at VALiNTRY
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPT
Introduction Database Management System for Course Database
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
ai tools demonstartion for schools and inter college
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Digital Strategies for Manufacturing Companies
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
medical staffing services at VALiNTRY
CHAPTER 2 - PM Management and IT Context
PTS Company Brochure 2025 (1).pdf.......
Operating system designcfffgfgggggggvggggggggg
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Computer Software and OS of computer science of grade 11.pptx
Navsoft: AI-Powered Business Solutions & Custom Software Development
2025 Textile ERP Trends: SAP, Odoo & Oracle
Introduction Database Management System for Course Database
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
ai tools demonstartion for schools and inter college
Designing Intelligence for the Shop Floor.pdf
How to Migrate SBCGlobal Email to Yahoo Easily
Digital Strategies for Manufacturing Companies
wealthsignaloriginal-com-DS-text-... (1).pdf
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Odoo Companies in India – Driving Business Transformation.pdf
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free

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.