SlideShare uma empresa Scribd logo
1 de 15
Django is a high-level Python Web framework that 
encourages rapid development, pragmatic design and follows 
DRY principles. 
By Abhijeet Shekhar 
Blog: http://ashekhar.wordpress.com
Features 
• Legacy DB 
• Test Framework 
• Multi- DB 
• Geodjango 
• Aggregation 
• JSON Serializer 
• Stable API Promise 
• Fantastic Docs 
• Generic View 
• Template Inheritance 
• Template Filters 
• Humanize 
• Runs on Jython /Iron 
Python 
• Google App Engine
Architecture
Component Architecture
Django is MTV/MVP framework 
-Model 
(app/models.py 
-Template 
( app/templates/*.html) 
-View (app/view.py)
Project Structure 
-project= the full website 
app=python library 
-Sample 
--__init__.py 
--settings.py 
--urls.py 
--wsgi.py 
-app-1 
--_init_.py 
--admin.py 
--models.py 
--tests.py 
--urls.py 
--view.py 
-app-2 
template/ 
manage.py 
env/ 
readme
Environment setup and installation 
Standard installation: 
• Content will be stored in the default location of 
python 
Virtual installation: 
• All dependent library can be installed in the virtual 
environment. 
• one project will be one virtualenv. 
• Every project with different dependencies in terms 
of libraries and version. 
• Easier to deploy and forget dependency 
• Virtualenvwrapper is a convenient
Steps to create a project 
• Create a project 
• Start an application 
• Create your database(Mysql, Post gre) 
• Configure DB settings in settings.py 
• Define your models 
• Add external modules 
• Add your template 
• Write your view 
• Create url mappping 
• Test application 
• Deploy application (linux apache , mod 
python
Initialize Your Project 
$ django-admin.py startproject <project_name> 
$ cd <project_name> 
$ Python manage.py startapp my 
$ edit settings.py and set DB info 
$ python manage.py runserver 
Browse http://localhost:8000
Settings: 
-multiple setting files: 
-per environment: dev, testing, staging , 
Production Per developer (local settings, 
use the host name ) 
-all setting file must inherit from , so you can do 
INSTALLED_APPS +=(‘debug_toolbar’) 
-version control all the setting !
Fat models, thin viewer… 
-multiple setting files: 
-per environment: dev, testing, staging , production 
Per developer (local settings, use the host name ) 
-all setting file must inherit from , so you can do 
INSTALLED_APPS +=(‘debug_toolbar’) 
-version control all the setting !
Debugging 
- ipython (./mange.py shell) 
- Ipdb 
- Import ipdb 
- Ipdb.set_trace() 
- django-debug-toolbar 
- very powerful 
- use it to optimze db performance, view by view
Migration 
- South/migrate: 
- Intelligent schema & data migrations for 
Django 
- Can do backward migrations
Deployment 
Web server 
- Niginx/Apache 
- wsgi 
- mod_python 
Static server 
- Nginx or any CDN
Thanks 

Mais conteúdo relacionado

Mais procurados

Introduction to django
Introduction to djangoIntroduction to django
Introduction to django
Ilian Iliev
 

Mais procurados (20)

Django Tutorial | Django Web Development With Python | Django Training and Ce...
Django Tutorial | Django Web Development With Python | Django Training and Ce...Django Tutorial | Django Web Development With Python | Django Training and Ce...
Django Tutorial | Django Web Development With Python | Django Training and Ce...
 
Python Django tutorial | Getting Started With Django | Web Development With D...
Python Django tutorial | Getting Started With Django | Web Development With D...Python Django tutorial | Getting Started With Django | Web Development With D...
Python Django tutorial | Getting Started With Django | Web Development With D...
 
Robot Framework Dos And Don'ts
Robot Framework Dos And Don'tsRobot Framework Dos And Don'ts
Robot Framework Dos And Don'ts
 
Introduction to django
Introduction to djangoIntroduction to django
Introduction to django
 
Introduction to Robot Framework
Introduction to Robot FrameworkIntroduction to Robot Framework
Introduction to Robot Framework
 
.Net Core
.Net Core.Net Core
.Net Core
 
Robot framework
Robot frameworkRobot framework
Robot framework
 
Typescript Fundamentals
Typescript FundamentalsTypescript Fundamentals
Typescript Fundamentals
 
Django Rest Framework | How to Create a RESTful API Using Django | Django Tut...
Django Rest Framework | How to Create a RESTful API Using Django | Django Tut...Django Rest Framework | How to Create a RESTful API Using Django | Django Tut...
Django Rest Framework | How to Create a RESTful API Using Django | Django Tut...
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Robot framework and selenium2 library
Robot framework and selenium2 libraryRobot framework and selenium2 library
Robot framework and selenium2 library
 
Google Chrome DevTools features overview
Google Chrome DevTools features overviewGoogle Chrome DevTools features overview
Google Chrome DevTools features overview
 
Xpath in Selenium | Selenium Xpath Tutorial | Selenium Xpath Examples | Selen...
Xpath in Selenium | Selenium Xpath Tutorial | Selenium Xpath Examples | Selen...Xpath in Selenium | Selenium Xpath Tutorial | Selenium Xpath Examples | Selen...
Xpath in Selenium | Selenium Xpath Tutorial | Selenium Xpath Examples | Selen...
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and Django
 
Reactjs
Reactjs Reactjs
Reactjs
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
Django Seminar
Django SeminarDjango Seminar
Django Seminar
 
Introduction To Django
Introduction To DjangoIntroduction To Django
Introduction To Django
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 

Destaque

9월 웨비나 - AWS 클라우드 보안의 이해 (양승도 솔루션즈 아키텍트)
9월 웨비나 - AWS 클라우드 보안의 이해 (양승도 솔루션즈 아키텍트)9월 웨비나 - AWS 클라우드 보안의 이해 (양승도 솔루션즈 아키텍트)
9월 웨비나 - AWS 클라우드 보안의 이해 (양승도 솔루션즈 아키텍트)
Amazon Web Services Korea
 

Destaque (9)

Unchain Your Web Development With Django
Unchain Your Web Development With DjangoUnchain Your Web Development With Django
Unchain Your Web Development With Django
 
Introduction to django
Introduction to djangoIntroduction to django
Introduction to django
 
9월 웨비나 - AWS 클라우드 보안의 이해 (양승도 솔루션즈 아키텍트)
9월 웨비나 - AWS 클라우드 보안의 이해 (양승도 솔루션즈 아키텍트)9월 웨비나 - AWS 클라우드 보안의 이해 (양승도 솔루션즈 아키텍트)
9월 웨비나 - AWS 클라우드 보안의 이해 (양승도 솔루션즈 아키텍트)
 
AWS Summit Seoul 2015 -CloudFront와 Route53 기반 콘텐츠 배포 전략 (GS네오텍-박정수)
AWS Summit Seoul 2015 -CloudFront와 Route53 기반 콘텐츠 배포 전략 (GS네오텍-박정수)AWS Summit Seoul 2015 -CloudFront와 Route53 기반 콘텐츠 배포 전략 (GS네오텍-박정수)
AWS Summit Seoul 2015 -CloudFront와 Route53 기반 콘텐츠 배포 전략 (GS네오텍-박정수)
 
DjangoGirls를 위한 Django on AWS - 윤석찬 (DjangoGirls Seoul 모임)
DjangoGirls를 위한 Django on AWS - 윤석찬 (DjangoGirls Seoul 모임)DjangoGirls를 위한 Django on AWS - 윤석찬 (DjangoGirls Seoul 모임)
DjangoGirls를 위한 Django on AWS - 윤석찬 (DjangoGirls Seoul 모임)
 
Python RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutionsPython RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutions
 
Scalable Django Architecture
Scalable Django ArchitectureScalable Django Architecture
Scalable Django Architecture
 
Web backends development using Python
Web backends development using PythonWeb backends development using Python
Web backends development using Python
 
Create responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJSCreate responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJS
 

Semelhante a Django

GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
Yared Ayalew
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introduction
vstorm83
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
LeanDog
 
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
Graham Dumpleton
 

Semelhante a Django (20)

Tutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer WorkshopTutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer Workshop
 
Django rest framework
Django rest frameworkDjango rest framework
Django rest framework
 
Google app-engine-with-python
Google app-engine-with-pythonGoogle app-engine-with-python
Google app-engine-with-python
 
Django dev-env-my-way
Django dev-env-my-wayDjango dev-env-my-way
Django dev-env-my-way
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
 
Django Overview
Django OverviewDjango Overview
Django Overview
 
Google App Engine for Python - Unit01: Basic
Google App Engine for Python - Unit01: BasicGoogle App Engine for Python - Unit01: Basic
Google App Engine for Python - Unit01: Basic
 
Django framework
Django framework Django framework
Django framework
 
Rock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsRock Solid Deployment of Web Applications
Rock Solid Deployment of Web Applications
 
Heroku pycon
Heroku pyconHeroku pycon
Heroku pycon
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introduction
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
 
Priming Your Teams For Microservice Deployment to the Cloud
Priming Your Teams For Microservice Deployment to the CloudPriming Your Teams For Microservice Deployment to the Cloud
Priming Your Teams For Microservice Deployment to the Cloud
 
Build Automation of PHP Applications
Build Automation of PHP ApplicationsBuild Automation of PHP Applications
Build Automation of PHP Applications
 
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
Iac d.damyanov 4.pptx
Iac d.damyanov 4.pptxIac d.damyanov 4.pptx
Iac d.damyanov 4.pptx
 
Django deployment with PaaS
Django deployment with PaaSDjango deployment with PaaS
Django deployment with PaaS
 
Build Your First SharePoint Framework Webpart
Build Your First SharePoint Framework WebpartBuild Your First SharePoint Framework Webpart
Build Your First SharePoint Framework Webpart
 
Useful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvmUseful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvm
 

Último

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 

Último (20)

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 

Django

  • 1. Django is a high-level Python Web framework that encourages rapid development, pragmatic design and follows DRY principles. By Abhijeet Shekhar Blog: http://ashekhar.wordpress.com
  • 2. Features • Legacy DB • Test Framework • Multi- DB • Geodjango • Aggregation • JSON Serializer • Stable API Promise • Fantastic Docs • Generic View • Template Inheritance • Template Filters • Humanize • Runs on Jython /Iron Python • Google App Engine
  • 5. Django is MTV/MVP framework -Model (app/models.py -Template ( app/templates/*.html) -View (app/view.py)
  • 6. Project Structure -project= the full website app=python library -Sample --__init__.py --settings.py --urls.py --wsgi.py -app-1 --_init_.py --admin.py --models.py --tests.py --urls.py --view.py -app-2 template/ manage.py env/ readme
  • 7. Environment setup and installation Standard installation: • Content will be stored in the default location of python Virtual installation: • All dependent library can be installed in the virtual environment. • one project will be one virtualenv. • Every project with different dependencies in terms of libraries and version. • Easier to deploy and forget dependency • Virtualenvwrapper is a convenient
  • 8. Steps to create a project • Create a project • Start an application • Create your database(Mysql, Post gre) • Configure DB settings in settings.py • Define your models • Add external modules • Add your template • Write your view • Create url mappping • Test application • Deploy application (linux apache , mod python
  • 9. Initialize Your Project $ django-admin.py startproject <project_name> $ cd <project_name> $ Python manage.py startapp my $ edit settings.py and set DB info $ python manage.py runserver Browse http://localhost:8000
  • 10. Settings: -multiple setting files: -per environment: dev, testing, staging , Production Per developer (local settings, use the host name ) -all setting file must inherit from , so you can do INSTALLED_APPS +=(‘debug_toolbar’) -version control all the setting !
  • 11. Fat models, thin viewer… -multiple setting files: -per environment: dev, testing, staging , production Per developer (local settings, use the host name ) -all setting file must inherit from , so you can do INSTALLED_APPS +=(‘debug_toolbar’) -version control all the setting !
  • 12. Debugging - ipython (./mange.py shell) - Ipdb - Import ipdb - Ipdb.set_trace() - django-debug-toolbar - very powerful - use it to optimze db performance, view by view
  • 13. Migration - South/migrate: - Intelligent schema & data migrations for Django - Can do backward migrations
  • 14. Deployment Web server - Niginx/Apache - wsgi - mod_python Static server - Nginx or any CDN