SlideShare a Scribd company logo
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Agenda
Why Django framework?
What is Django?
Architecture: MVC-MVT Pattern
Hands On: Get Started With Django
Building Blocks of Django
Project: A Web Application
1
2
3
4
5
6
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Why Django Framework?
First, let’s understand how Django came into existence
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Why Django Framework?
❑ Django is a Python web framework
❑ A framework provides a structure and common methods to make the life of a web application
developer much easier for building flexible, scalable and maintainable web applications
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Why Django Framework?
➢ A Python web framework is a code library that provide
tools and libraries to simplify common web development
operations.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
What is Django?
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
What is Django?
Django is a high-level and has a MVC-
MVT styled architecture.
Django web framework is written on
quick and powerful Python language.
Django has a open-source collection of
libraries for building a fully functioning
web application.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Features of Django
F U L LY L O A D E D
F A S T
S E C U R E
S C A L A B L E
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Django MVC-MVT Pattern
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Django MVC-MVT Pattern
➢ MVC is slightly different from MVT as Django itself takes care of the Controller part.
➢ It leaves the template which is a HTML file mixed with Django Template Language (DTL).
Model View Template
Model
View
Controller
Request
MVC MVT
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Model View Controller
The developer provides the Model, the view and the template then just maps it to a URL
and Django does the magic to serve it to the user.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Hands on
Now, let’s create a basic Web App
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Installation
Go to the link:
https://www.djangoproject.
com/download/
1
2 Install the latest
version of Django
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Create a Project
$ django-admin startproject firstproject
Open the terminal and navigate to the folder where the project is to be created.
Firstproject/
manage.py
firstproject/
__init__.py
settings.py
urls.py
wsgi.py
This will create a "myproject" folder with the following structure:
1
2
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Project Structure
“firstproject” folder is just your project container or
directory. You can rename it to anything you like.
firstproject/
firstproject
__init__.py
settings.py
urls.py
wsgi.py
manage.py
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Project Structure
This folder is the actual python package of your project
which contains some default files.
firstproject/
firstproject
__init__.py
settings.py
urls.py
wsgi.py
manage.py
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Project Structure
It is an empty file that tells python that this folder
should be treated as package.
firstproject/
firstproject
__init__.py
settings.py
urls.py
wsgi.py
manage.py
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Project Structure
This contains the settings or the configurations of the
project.
firstproject/
firstproject
__init__.py
settings.py
urls.py
wsgi.py
manage.py
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Project Structure
This file contains all the links of your project and the
function to call.
firstproject/
firstproject
__init__.py
settings.py
urls.py
wsgi.py
manage.py
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Project Structure
It is an entry point for WSGI-compatible web services to
serve your project.
firstproject/
firstproject
__init__.py
settings.py
urls.py
wsgi.py
manage.py
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Project Structure
It is a command line utility that lets you interact with the
Django project.
firstproject/
firstproject
__init__.py
settings.py
urls.py
wsgi.py
manage.py
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Your First Web App
Congratulations! We have successful created a basic
Web App.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Components of Django
Now, let’s understand the components/ building blocks of Django
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Building Blocks of Django
ORM
URLs and Views
Templates
Forms
Authentication
Admin
Internationalization
Security
ORM stands for Object-relational Mapper.
Define your data models. You get a rich, dynamic
database-access API for free but you can still write
SQL if needed.
from django.db import models
Class employees(models.Model):
firstname = models.CharField(max_length=10)
Lastname = models.CharField(max_length=10)
def _str_(self):
return self.firstname
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
URLs and Views
ORM
Templates
Forms
Authentication
Admin
Internationalization
Security
Like a table of contents for your app, it contains a
simple mapping between URL patterns and your
views.
from Django.shortcuts import
render
def index(request):
return HttpResponse
(<h2> Hey! Welcome to Django
tutorial</h2>)
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
URL
Mapping views and URL
Building Blocks of Django
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Building Blocks of Django
Templates
ORM
URLs and Views
Forms
Authentication
Admin
Internationalization
Security
Templates are designed to feel comfortable and
for those who work with HTML, like designers and
front-end developers.
TEMPLATE_DIRS = (
'<workspace>/django_project/templates/',
)
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Building Blocks of Django
Forms
ORM
URLs and Views
Templates
Authentication
Admin
Internationalization
Security
Django provides a powerful form library that handles
rendering forms as HTML, validating user-submitted
data, and converting that data to native Python types.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Building Blocks of Django
Authentication
ORM
URLs and Views
Templates
Forms
Admin
Internationalization
Security
It handles user accounts, groups, permissions and
cookie-based user sessions.
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
@login_required
def my_protected_view(request):
return render(request, 'protected.html', {'current_user':
request.user})
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Building Blocks of Django
Admin
ORM
URLs and Views
Templates
Forms
Authentication
Internationalization
Security
It is the most powerful part that reads metadata in
your models to provide a powerful and
production-ready interface that can be used to
manage content on your site.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Building Blocks of Django
Internationalization
ORM
URLs and Views
Templates
Forms
Authentication
Admin
Security
Django offers full support for translating text into
different languages, plus locale-specific
formatting of dates, times, numbers and time
zones.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Building Blocks of Django
Security
ORM
URLs and Views
Templates
Forms
Authentication
Admin
Internationalization
✓ Clickjacking
✓ Cross-site scripting
✓ Cross Site Request Forgery (CSRF)
✓ SQL injection
✓ Remote code execution
Django provides multiple protections against:
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Project
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Session In A Minute
Django Framework
ProjectComponentsHands On
ArchitectureWhat is Django
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Django Tutorial | Django Web Development With Python | Django Training and Certification | Edureka

More Related Content

PDF
Python Django tutorial | Getting Started With Django | Web Development With D...
PPT
DJango
PDF
Django interview Questions| Edureka
PDF
Python/Django Training
PPTX
Django - Python MVC Framework
PDF
Web Development with Python and Django
PPTX
Django Seminar
KEY
Introduction to Django
Python Django tutorial | Getting Started With Django | Web Development With D...
DJango
Django interview Questions| Edureka
Python/Django Training
Django - Python MVC Framework
Web Development with Python and Django
Django Seminar
Introduction to Django

What's hot (20)

PDF
Django Introduction & Tutorial
PDF
Introduction to django framework
PPT
Introduction To Django
PPTX
Introduction to Django
PPTX
Django Framework Overview forNon-Python Developers
PDF
A Basic Django Introduction
PPTX
Django PPT.pptx
PDF
Introduction to django
PPTX
Web development with django - Basics Presentation
ODP
Django for Beginners
PDF
jQuery for beginners
PPTX
PPTX
Fundamentals of Python Programming
PDF
ORM in Django
PPTX
Introduction to php
PPT
SQLITE Android
PPT
PHP POWERPOINT SLIDES
PPS
Introduction to Mysql
ODP
Introduction to Swagger
PPTX
Php.ppt
Django Introduction & Tutorial
Introduction to django framework
Introduction To Django
Introduction to Django
Django Framework Overview forNon-Python Developers
A Basic Django Introduction
Django PPT.pptx
Introduction to django
Web development with django - Basics Presentation
Django for Beginners
jQuery for beginners
Fundamentals of Python Programming
ORM in Django
Introduction to php
SQLITE Android
PHP POWERPOINT SLIDES
Introduction to Mysql
Introduction to Swagger
Php.ppt
Ad

Similar to Django Tutorial | Django Web Development With Python | Django Training and Certification | Edureka (20)

PDF
What is Django | Django Tutorial for Beginners | Python Django Training | Edu...
PDF
Web development django.pdf
PPTX
Introduction to Django
PPTX
Basic Python Django
PDF
Rapid web application development using django - Part (1)
PDF
Django Workflow and Architecture
PDF
Django
PDF
Django Documentation
PDF
A gentle intro to the Django Framework
DOCX
Akash rajguru project report sem v
PPTX
Django course
PDF
django_introduction20141030
PPTX
The Django Web Application Framework 2
PPTX
The Django Web Application Framework 2
PPTX
The Django Web Application Framework 2
PPTX
The Django Web Application Framework 2
PPTX
Tango with django
PPTX
Django crush course
PPTX
Unleash-the-power-of-Django.pptx
What is Django | Django Tutorial for Beginners | Python Django Training | Edu...
Web development django.pdf
Introduction to Django
Basic Python Django
Rapid web application development using django - Part (1)
Django Workflow and Architecture
Django
Django Documentation
A gentle intro to the Django Framework
Akash rajguru project report sem v
Django course
django_introduction20141030
The Django Web Application Framework 2
The Django Web Application Framework 2
The Django Web Application Framework 2
The Django Web Application Framework 2
Tango with django
Django crush course
Unleash-the-power-of-Django.pptx
Ad

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
PDF
Top 5 Trending Business Intelligence Tools | Edureka
PDF
Tableau Tutorial for Data Science | Edureka
PDF
Python Programming Tutorial | Edureka
PDF
Top 5 PMP Certifications | Edureka
PDF
Top Maven Interview Questions in 2020 | Edureka
PDF
Linux Mint Tutorial | Edureka
PDF
How to Deploy Java Web App in AWS| Edureka
PDF
Importance of Digital Marketing | Edureka
PDF
RPA in 2020 | Edureka
PDF
Email Notifications in Jenkins | Edureka
PDF
EA Algorithm in Machine Learning | Edureka
PDF
Cognitive AI Tutorial | Edureka
PDF
AWS Cloud Practitioner Tutorial | Edureka
PDF
Blue Prism Top Interview Questions | Edureka
PDF
Big Data on AWS Tutorial | Edureka
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
PDF
Kubernetes Installation on Ubuntu | Edureka
PDF
Introduction to DevOps | Edureka
What to learn during the 21 days Lockdown | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Tableau Tutorial for Data Science | Edureka
Python Programming Tutorial | Edureka
Top 5 PMP Certifications | Edureka
Top Maven Interview Questions in 2020 | Edureka
Linux Mint Tutorial | Edureka
How to Deploy Java Web App in AWS| Edureka
Importance of Digital Marketing | Edureka
RPA in 2020 | Edureka
Email Notifications in Jenkins | Edureka
EA Algorithm in Machine Learning | Edureka
Cognitive AI Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Blue Prism Top Interview Questions | Edureka
Big Data on AWS Tutorial | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Kubernetes Installation on Ubuntu | Edureka
Introduction to DevOps | Edureka

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Electronic commerce courselecture one. Pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
KodekX | Application Modernization Development
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPT
Teaching material agriculture food technology
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Review of recent advances in non-invasive hemoglobin estimation
Advanced methodologies resolving dimensionality complications for autism neur...
Unlocking AI with Model Context Protocol (MCP)
Electronic commerce courselecture one. Pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Mobile App Security Testing_ A Comprehensive Guide.pdf
NewMind AI Monthly Chronicles - July 2025
KodekX | Application Modernization Development
Chapter 3 Spatial Domain Image Processing.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Diabetes mellitus diagnosis method based random forest with bat algorithm
“AI and Expert System Decision Support & Business Intelligence Systems”
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Understanding_Digital_Forensics_Presentation.pptx
Teaching material agriculture food technology
NewMind AI Weekly Chronicles - August'25 Week I
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...

Django Tutorial | Django Web Development With Python | Django Training and Certification | Edureka

  • 1. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
  • 2. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Agenda Why Django framework? What is Django? Architecture: MVC-MVT Pattern Hands On: Get Started With Django Building Blocks of Django Project: A Web Application 1 2 3 4 5 6
  • 3. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why Django Framework? First, let’s understand how Django came into existence
  • 4. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why Django Framework? ❑ Django is a Python web framework ❑ A framework provides a structure and common methods to make the life of a web application developer much easier for building flexible, scalable and maintainable web applications
  • 5. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Why Django Framework? ➢ A Python web framework is a code library that provide tools and libraries to simplify common web development operations.
  • 6. Copyright © 2017, edureka and/or its affiliates. All rights reserved. What is Django?
  • 7. Copyright © 2017, edureka and/or its affiliates. All rights reserved. What is Django? Django is a high-level and has a MVC- MVT styled architecture. Django web framework is written on quick and powerful Python language. Django has a open-source collection of libraries for building a fully functioning web application.
  • 8. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Features of Django F U L LY L O A D E D F A S T S E C U R E S C A L A B L E
  • 9. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Django MVC-MVT Pattern
  • 10. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Django MVC-MVT Pattern ➢ MVC is slightly different from MVT as Django itself takes care of the Controller part. ➢ It leaves the template which is a HTML file mixed with Django Template Language (DTL). Model View Template Model View Controller Request MVC MVT
  • 11. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Model View Controller The developer provides the Model, the view and the template then just maps it to a URL and Django does the magic to serve it to the user.
  • 12. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Hands on Now, let’s create a basic Web App
  • 13. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Installation Go to the link: https://www.djangoproject. com/download/ 1 2 Install the latest version of Django
  • 14. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Create a Project $ django-admin startproject firstproject Open the terminal and navigate to the folder where the project is to be created. Firstproject/ manage.py firstproject/ __init__.py settings.py urls.py wsgi.py This will create a "myproject" folder with the following structure: 1 2
  • 15. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Project Structure “firstproject” folder is just your project container or directory. You can rename it to anything you like. firstproject/ firstproject __init__.py settings.py urls.py wsgi.py manage.py
  • 16. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Project Structure This folder is the actual python package of your project which contains some default files. firstproject/ firstproject __init__.py settings.py urls.py wsgi.py manage.py
  • 17. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Project Structure It is an empty file that tells python that this folder should be treated as package. firstproject/ firstproject __init__.py settings.py urls.py wsgi.py manage.py
  • 18. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Project Structure This contains the settings or the configurations of the project. firstproject/ firstproject __init__.py settings.py urls.py wsgi.py manage.py
  • 19. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Project Structure This file contains all the links of your project and the function to call. firstproject/ firstproject __init__.py settings.py urls.py wsgi.py manage.py
  • 20. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Project Structure It is an entry point for WSGI-compatible web services to serve your project. firstproject/ firstproject __init__.py settings.py urls.py wsgi.py manage.py
  • 21. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Project Structure It is a command line utility that lets you interact with the Django project. firstproject/ firstproject __init__.py settings.py urls.py wsgi.py manage.py
  • 22. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Your First Web App Congratulations! We have successful created a basic Web App.
  • 23. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Components of Django Now, let’s understand the components/ building blocks of Django
  • 24. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Building Blocks of Django ORM URLs and Views Templates Forms Authentication Admin Internationalization Security ORM stands for Object-relational Mapper. Define your data models. You get a rich, dynamic database-access API for free but you can still write SQL if needed. from django.db import models Class employees(models.Model): firstname = models.CharField(max_length=10) Lastname = models.CharField(max_length=10) def _str_(self): return self.firstname
  • 25. Copyright © 2017, edureka and/or its affiliates. All rights reserved. URLs and Views ORM Templates Forms Authentication Admin Internationalization Security Like a table of contents for your app, it contains a simple mapping between URL patterns and your views. from Django.shortcuts import render def index(request): return HttpResponse (<h2> Hey! Welcome to Django tutorial</h2>) from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.index, name='index'), ] URL Mapping views and URL Building Blocks of Django
  • 26. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Building Blocks of Django Templates ORM URLs and Views Forms Authentication Admin Internationalization Security Templates are designed to feel comfortable and for those who work with HTML, like designers and front-end developers. TEMPLATE_DIRS = ( '<workspace>/django_project/templates/', )
  • 27. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Building Blocks of Django Forms ORM URLs and Views Templates Authentication Admin Internationalization Security Django provides a powerful form library that handles rendering forms as HTML, validating user-submitted data, and converting that data to native Python types.
  • 28. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Building Blocks of Django Authentication ORM URLs and Views Templates Forms Admin Internationalization Security It handles user accounts, groups, permissions and cookie-based user sessions. from django.contrib.auth.decorators import login_required from django.shortcuts import render @login_required def my_protected_view(request): return render(request, 'protected.html', {'current_user': request.user})
  • 29. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Building Blocks of Django Admin ORM URLs and Views Templates Forms Authentication Internationalization Security It is the most powerful part that reads metadata in your models to provide a powerful and production-ready interface that can be used to manage content on your site.
  • 30. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Building Blocks of Django Internationalization ORM URLs and Views Templates Forms Authentication Admin Security Django offers full support for translating text into different languages, plus locale-specific formatting of dates, times, numbers and time zones.
  • 31. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Building Blocks of Django Security ORM URLs and Views Templates Forms Authentication Admin Internationalization ✓ Clickjacking ✓ Cross-site scripting ✓ Cross Site Request Forgery (CSRF) ✓ SQL injection ✓ Remote code execution Django provides multiple protections against:
  • 32. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Project
  • 33. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Session In A Minute Django Framework ProjectComponentsHands On ArchitectureWhat is Django
  • 34. Copyright © 2017, edureka and/or its affiliates. All rights reserved.