SlideShare una empresa de Scribd logo
1 de 63
Web Application Development
               Django Framework




              Fabrizio Lapiello
                       IT Eng. Student
                    http://flapiello.com
Table of contents
   “Step by Step”




                    2
Table of contents
             “Step by Step”


Step 0: Django Introduction
Step 1: Admin Panel
Step 2: URL
Step 3: Creating an application




                                  2
Step 0
Introduction: Django Framework




                                 3
Step 0
    Introduction: Django Framework


0) The Framework
1) MTV Pattern
2) DBMS
3) Setup
4) “Hello World”
 4.1) Creating and compiling
 4.2) Creating a View
                                     3
The Framework:
What is Django?




                  4
The Framework:
               What is Django?
Django is a great framework for building Web 2.0 applications!
  It 'was designed to improve development time and quality.




                   http://www.djangoproject.org




                                                                 4
MTV Pattern
“Model-Template-View”




                        5
MTV Pattern
              “Model-Template-View”
A pattern that helps to separate the user interface level from
  the other parts of the system.

Model - contains classes whose
 instances represent the data to
 display and manipulate.
Template - contains objects that
  control and manage user interaction
  with the model and view layers.
View - contains the objects used in the
  UI to display the data in the model.




                                                                 5
DBMS
        “Database management system”
Some of the most well-known DBMS used in Django:




                                                   6
DBMS
        “Database management system”
Some of the most well-known DBMS used in Django:




                                                   6
Prior Knowledge




                  7
Prior Knowledge




     ...that’s all!




                      7
Good reasons to learn Python
Well-known companies have adopted it for their business:




                                                           8
Good reasons to learn Python
Well-known companies have adopted it for their business:




                                                           8
Setup




        9
Setup
Download:
   http://www.djangoproject.com/download/


Setup Guide:
   http://docs.djangoproject.com/en/dev/intro/install/


Official Documentation:
   http://docs.djangoproject.com/




                                                         9
Creating and compiling project




                                 10
Creating and compiling project
$ django-admin.py startproject hello
      -> __Init__.py
         manage.py
         settings.py
         urls.py

$ python manage.py runserver
      -> 0 Error Found
      http://127.0.0.1:8000 -> Worked!!




                                          10
Creating a view
   First Step




                  11
Creating a view
                            First Step
First of all combining a URL to a view
   -> http://127.0.0.1:8000/hello


Open the file urls.py and insert the following string as the last
  parameter:
   -> (r’^hello/$’, “views.hello”)




                                                                    11
Creating a view
                            First Step
First of all combining a URL to a view
   -> http://127.0.0.1:8000/hello


Open the file urls.py and insert the following string as the last
  parameter:
   -> (r’^hello/$’, “views.hello”)




                                                                    11
Creating a view
                             First Step
First of all combining a URL to a view
    -> http://127.0.0.1:8000/hello


Open the file urls.py and insert the following string as the last
  parameter:
    -> (r’^hello/$’, “views.hello”)

  Regular expression that
indicates the beginning
and the end of the URL.




                                                                    11
Creating a view
                             First Step
First of all combining a URL to a view
    -> http://127.0.0.1:8000/hello


Open the file urls.py and insert the following string as the last
  parameter:
    -> (r’^hello/$’, “views.hello”)

  Regular expression that
indicates the beginning
and the end of the URL.




                                                                    11
Creating a view
                                First Step
First of all combining a URL to a view
    -> http://127.0.0.1:8000/hello


Open the file urls.py and insert the following string as the last
  parameter:
    -> (r’^hello/$’, “views.hello”)

  Regular expression that
indicates the beginning     Combining Url/Vista
and the end of the URL.




                                                                    11
Creating a view
                          Second Step
The view is simply a Python method that returns the data.
In the root of the project we create the views.py file and insert the
   following method:


             from django.http import HttpResponse
             def hello(request):
                  return HttpResponse(“Hello World”)


Now type in a terminal:
$ python manage.py runserver


                                                                        12
Step 1
Admin Panel




              13
Step 1
               Admin Panel


0) Creating applications
1) Creating models
2) Add a Database
3) ORM
4) Creating Admin Panel


                             13
Creating Applications
Is good practice to structure the project into sub-applications in
   order to have greater control over the entire system to be
   developed!
$ python manage.py startapp test
If there aren't errors in the root of the project should have a folder
    named "test" with the following files inside
__init__.py
models.py
views.py
Inatalled_Apps indicate the presence in the settings.py file,
   application "test" by simply inserting his name in quotes at the
   bottom of the list.

                                                                         14
Creating models
Change the models.py file in the folder "test "...

       from django.db import models
       class Persona (models.Model):
         nome = models.CharField(max_length=50)
         cognome = models.CharField(max_length=50)
         def __unicode__(self):
              return u"%s %s" % (self.nome, self.cognome)
         class Meta:
              verbose_name_plural ="Persone"


                                                            15
Add a Database
Edit the settings.py file in the following way:

      DATABASES = {
          'default': {
              'ENGINE': 'sqlite3', #NAME del dbms es (oracle, mysql etc..)
              'NAME': 'test.db', #DB NAME
              'USER': '', #USERNAME
              'PASSWORD': '', #Password
              'HOST': '', #DMBS ADDRESS
              'PORT': '', #PORT
          }
      }

                                                                             16
ORM
“Object-Relational Mapping”




                              17
ORM
“Object-Relational Mapping”

        An ORM is a kind of linker between
          objects and relational databases.




                                              17
ORM
“Object-Relational Mapping”

        An ORM is a kind of linker between
          objects and relational databases.


        Through this linker the created objects
          with a high-level language are
          included in the relational database.




                                                  17
ORM
“Object-Relational Mapping”

        An ORM is a kind of linker between
          objects and relational databases.


        Through this linker the created objects
          with a high-level language are
          included in the relational database.




                                                  17
ORM
“Object-Relational Mapping”

        An ORM is a kind of linker between
          objects and relational databases.


        Through this linker the created objects
          with a high-level language are
          included in the relational database.




                                                  17
ORM
“Object-Relational Mapping”

        An ORM is a kind of linker between
          objects and relational databases.


        Through this linker the created objects
          with a high-level language are
          included in the relational database.



              $ python manage.py syncdb



                                                  17
Creating Admin Panel
                      First Step
Open the file settings.py INSTALLED_APPS and insert in the
  application for the board of directors as follows:



               INSTALLED_APPS = (
                 'django.contrib.auth',
                 'django.contrib.contenttypes',
                 'django.contrib.sessions',
                 'django.contrib.sites',
                 'django.contrib.messages',
                 'django.contrib.admin',
               )



                                                             18
Creating Admin Panel
                       Second Step
Associate a URL to the application, then edit the urls.py file as
  follows:
                   from django.contrib import admin
                   admin.autodiscover()

                   urlpatterns = patterns('',
                       (r'^admin/', include(admin.site.urls)),
                       (r'^hello/$', "views.hello"),
                   )




                                                                    19
Creating Admin Panel
                       Second Step
Associate a URL to the application, then edit the urls.py file as
  follows:
                   from django.contrib import admin
                   admin.autodiscover()

                   urlpatterns = patterns('',




                                                         !
                       (r'^admin/', include(admin.site.urls)),




                                                      là
                       (r'^hello/$', "views.hello"),




                                                   oi
                   )




                            E t                   V
                                                                    19
Step 2
 URL




         20
Step 2
                     URL



0) URL
1) Creating an URL




                           20
URL
                 Uniform Resource Locator
Benefit of having "ordered" URL
   - Easy to remember
   - Palatability by search engines
   - Durable


   Example:
   1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17


   2) http://nomedominio.com/blog




                                                                                                     21
URL
                 Uniform Resource Locator
Benefit of having "ordered" URL
   - Easy to remember
   - Palatability by search engines
   - Durable


   Example:
   1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17


   2) http://nomedominio.com/blog




                                                                                                     21
URL
                 Uniform Resource Locator
Benefit of having "ordered" URL
   - Easy to remember
   - Palatability by search engines
   - Durable


   Example:
   1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17


   2) http://nomedominio.com/blog




                                                                                                     21
URL
                 Uniform Resource Locator
Benefit of having "ordered" URL
   - Easy to remember
   - Palatability by search engines
   - Durable                                                                                    n g!
                                                                                            yi
                                                                                      r rif
                                                                                   Ho
   Example:
   1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17


   2) http://nomedominio.com/blog




                                                                                                       21
URL
                 Uniform Resource Locator
Benefit of having "ordered" URL
   - Easy to remember
   - Palatability by search engines
   - Durable                                                                                    n g!
                                                                                            yi
                                                                                      r rif
                                                                                   Ho
   Example:
   1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17


   2) http://nomedominio.com/blog




                                                                                                       21
URL
                 Uniform Resource Locator
Benefit of having "ordered" URL
   - Easy to remember
   - Palatability by search engines
   - Durable                                                                                      n g!
                                                                                              yi
                                                                                        r rif
                                                                                   Ho
   Example:
   1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17


   2) http://nomedominio.com/blog
                                                                                   to
                                                                                        be
                                                                                             rep
                                                                                                   lac
                                                                                                         ed


                                                                                                              21
URL
                 Uniform Resource Locator
Benefit of having "ordered" URL
   - Easy to remember
   - Palatability by search engines
   - Durable                                                                                      n g!
                                                                                              yi
                                                                                        r rif
                                                                                   Ho
   Example:
   1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17


   2) http://nomedominio.com/blog
                                                                                   to
                                                                                        be
                                                                                             rep
                                                                                                   lac
                                                                                                         ed


                                                                                                              21
URL
                 Uniform Resource Locator
Benefit of having "ordered" URL
   - Easy to remember
   - Palatability by search engines
   - Durable                                                                                      n g!
                                                                                              yi
                                                                                        r rif
                                                                                   Ho
   Example:
   1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17


   2) http://nomedominio.com/blog
                                                                                   to
                                                                                        be
                                                                                             rep
                                                                                                   lac
                                                                                                         ed


                                                                                                              21
URL
                 Uniform Resource Locator
Benefit of having "ordered" URL
   - Easy to remember
   - Palatability by search engines
   - Durable                                                                                      n g!
                                                                                              yi
                                                                                        r rif
                                                                                   Ho
   Example:
   1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17


   2) http://nomedominio.com/blog
                                                                                   to
                                                                                        be
                                                                                             rep
                                                                                                   lac
                                                                                                         ed


                                                                                                              21
URL
                 Uniform Resource Locator
Benefit of having "ordered" URL
   - Easy to remember
   - Palatability by search engines
   - Durable                                                                                      n g!
                                                                                              yi
                                                                                        r rif
                                                                                   Ho
   Example:
   1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17


   2) http://nomedominio.com/blog
                                                                                   to
                                                                                        be
                                                                                             rep
                                                                                                   lac
                                                                                                         ed


                                                                                                              21
URL
                 Uniform Resource Locator
Benefit of having "ordered" URL
   - Easy to remember
   - Palatability by search engines
   - Durable                                                                                      n g!
                                                                                              yi
                                                                                        r rif
                                                                                   Ho
   Example:
   1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17


   2) http://nomedominio.com/blog
                                                                                   to
                                                                                        be
                                                                                             rep
                                                                                                   lac
                                                                                                         ed


                                                                                                              21
URL
                 Uniform Resource Locator
Benefit of having "ordered" URL
   - Easy to remember
   - Palatability by search engines
   - Durable                                                                                      n g!
                                                                                              yi
                                                                                        r rif
                                                                                   Ho
   Example:
   1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17


   2) http://nomedominio.com/blog
                                                                                   to
                                                                                        be
                                                                                             rep
                                                                                                   lac
                                                                                                         ed


                                                                                                              21
Creating URL
To create a URL like the following
   -> http://127.0.0.1:8000/hello
you have to combine the view of the URL, so, you have to open the
  file urls.py and insert the following string as the last parameter:
   -> (r’^hello/$’, “views.hello”)




                                                                        22
Creating URL
To create a URL like the following
   -> http://127.0.0.1:8000/hello
you have to combine the view of the URL, so, you have to open the
  file urls.py and insert the following string as the last parameter:
   -> (r’^hello/$’, “views.hello”)




                                                                        22
Creating URL
To create a URL like the following
   -> http://127.0.0.1:8000/hello
you have to combine the view of the URL, so, you have to open the
  file urls.py and insert the following string as the last parameter:
   -> (r’^hello/$’, “views.hello”)




                                                                        22
Creating URL
To create a URL like the following
   -> http://127.0.0.1:8000/hello
you have to combine the view of the URL, so, you have to open the
  file urls.py and insert the following string as the last parameter:
   -> (r’^hello/$’, “views.hello”)
  Regular expression that
indicates the beginning
and the end of the URL.




                                                                        22
Creating URL
To create a URL like the following
   -> http://127.0.0.1:8000/hello
you have to combine the view of the URL, so, you have to open the
  file urls.py and insert the following string as the last parameter:
   -> (r’^hello/$’, “views.hello”)
  Regular expression that
indicates the beginning     Combining Url/Vista
and the end of the URL.




                                                                        22
Step 3
Creating an application




                          23
Step 3
Creating an application




  DEMO
                          23
Contacts
 A Q
F      Fabrizio Lapiello
       IT Eng. Student
       Email: flapiello@aol.com
       Web: http://lfapiello.com

Más contenido relacionado

La actualidad más candente

Django Framework Overview forNon-Python Developers
Django Framework Overview forNon-Python DevelopersDjango Framework Overview forNon-Python Developers
Django Framework Overview forNon-Python DevelopersRosario Renga
 
Web development with django - Basics Presentation
Web development with django - Basics PresentationWeb development with django - Basics Presentation
Web development with django - Basics PresentationShrinath Shenoy
 
Django - Python MVC Framework
Django - Python MVC FrameworkDjango - Python MVC Framework
Django - Python MVC FrameworkBala Kumar
 
Introduction To Django
Introduction To DjangoIntroduction To Django
Introduction To DjangoJay Graves
 
Introduction to django
Introduction to djangoIntroduction to django
Introduction to djangoIlian Iliev
 
Django Framework and Application Structure
Django Framework and Application StructureDjango Framework and Application Structure
Django Framework and Application StructureSEONGTAEK OH
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and DjangoMichael Pirnat
 
Building an API with Django and Django REST Framework
Building an API with Django and Django REST FrameworkBuilding an API with Django and Django REST Framework
Building an API with Django and Django REST FrameworkChristopher Foresman
 
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...Edureka!
 
Presentation of framework Angular
Presentation of framework AngularPresentation of framework Angular
Presentation of framework AngularLhouceine OUHAMZA
 
Full Stack Web Development
Full Stack Web DevelopmentFull Stack Web Development
Full Stack Web DevelopmentSWAGATHCHOWDARY1
 
Django Rest Framework - Building a Web API
Django Rest Framework - Building a Web APIDjango Rest Framework - Building a Web API
Django Rest Framework - Building a Web APIMarcos Pereira
 

La actualidad más candente (20)

Django Framework Overview forNon-Python Developers
Django Framework Overview forNon-Python DevelopersDjango Framework Overview forNon-Python Developers
Django Framework Overview forNon-Python Developers
 
django
djangodjango
django
 
Web development with django - Basics Presentation
Web development with django - Basics PresentationWeb development with django - Basics Presentation
Web development with django - Basics Presentation
 
Django - Python MVC Framework
Django - Python MVC FrameworkDjango - Python MVC Framework
Django - Python MVC Framework
 
Introduction To Django
Introduction To DjangoIntroduction To Django
Introduction To Django
 
Django Girls Tutorial
Django Girls TutorialDjango Girls Tutorial
Django Girls Tutorial
 
Introduction to django
Introduction to djangoIntroduction to django
Introduction to django
 
Free django
Free djangoFree django
Free django
 
Django Framework and Application Structure
Django Framework and Application StructureDjango Framework and Application Structure
Django Framework and Application Structure
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and Django
 
Django
DjangoDjango
Django
 
Angular 2
Angular 2Angular 2
Angular 2
 
Building an API with Django and Django REST Framework
Building an API with Django and Django REST FrameworkBuilding an API with Django and Django REST Framework
Building an API with Django and Django REST Framework
 
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...
 
Presentation of framework Angular
Presentation of framework AngularPresentation of framework Angular
Presentation of framework Angular
 
Angular
AngularAngular
Angular
 
Full Stack Web Development
Full Stack Web DevelopmentFull Stack Web Development
Full Stack Web Development
 
React JS
React JSReact JS
React JS
 
Spring boot
Spring bootSpring boot
Spring boot
 
Django Rest Framework - Building a Web API
Django Rest Framework - Building a Web APIDjango Rest Framework - Building a Web API
Django Rest Framework - Building a Web API
 

Similar a Web application development with Django framework

An Introduction to Django Web Framework
An Introduction to Django Web FrameworkAn Introduction to Django Web Framework
An Introduction to Django Web FrameworkDavid Gibbons
 
Django is a high-level Python web framework that enables rapid development of...
Django is a high-level Python web framework that enables rapid development of...Django is a high-level Python web framework that enables rapid development of...
Django is a high-level Python web framework that enables rapid development of...ArijitDutta80
 
بررسی چارچوب جنگو
بررسی چارچوب جنگوبررسی چارچوب جنگو
بررسی چارچوب جنگوrailsbootcamp
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails BasicsAmit Solanki
 
Building Shiny Application Series - Layout and HTML
Building Shiny Application Series - Layout and HTMLBuilding Shiny Application Series - Layout and HTML
Building Shiny Application Series - Layout and HTMLOlga Scrivner
 
Open erp technical_memento_v0.6.3_a4
Open erp technical_memento_v0.6.3_a4Open erp technical_memento_v0.6.3_a4
Open erp technical_memento_v0.6.3_a4openerpwiki
 
Build and deploy Python Django project
Build and deploy Python Django projectBuild and deploy Python Django project
Build and deploy Python Django projectXiaoqi Zhao
 
Django tutorial
Django tutorialDjango tutorial
Django tutorialKsd Che
 
Drupal 8 preview_slideshow
Drupal 8 preview_slideshowDrupal 8 preview_slideshow
Drupal 8 preview_slideshowTee Malapela
 
OpenERP Technical Memento V0.7.3
OpenERP Technical Memento V0.7.3OpenERP Technical Memento V0.7.3
OpenERP Technical Memento V0.7.3Borni DHIFI
 
Mini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico CesMini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico CesLeonardo Fernandes
 

Similar a Web application development with Django framework (20)

Django by rj
Django by rjDjango by rj
Django by rj
 
Mini Curso de Django
Mini Curso de DjangoMini Curso de Django
Mini Curso de Django
 
Django
DjangoDjango
Django
 
DJango
DJangoDJango
DJango
 
An Introduction to Django Web Framework
An Introduction to Django Web FrameworkAn Introduction to Django Web Framework
An Introduction to Django Web Framework
 
Django is a high-level Python web framework that enables rapid development of...
Django is a high-level Python web framework that enables rapid development of...Django is a high-level Python web framework that enables rapid development of...
Django is a high-level Python web framework that enables rapid development of...
 
بررسی چارچوب جنگو
بررسی چارچوب جنگوبررسی چارچوب جنگو
بررسی چارچوب جنگو
 
React django
React djangoReact django
React django
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails Basics
 
Building Shiny Application Series - Layout and HTML
Building Shiny Application Series - Layout and HTMLBuilding Shiny Application Series - Layout and HTML
Building Shiny Application Series - Layout and HTML
 
Open erp technical_memento_v0.6.3_a4
Open erp technical_memento_v0.6.3_a4Open erp technical_memento_v0.6.3_a4
Open erp technical_memento_v0.6.3_a4
 
Django - basics
Django - basicsDjango - basics
Django - basics
 
Build and deploy Python Django project
Build and deploy Python Django projectBuild and deploy Python Django project
Build and deploy Python Django project
 
RoR guide_p1
RoR guide_p1RoR guide_p1
RoR guide_p1
 
Django tutorial
Django tutorialDjango tutorial
Django tutorial
 
Mongo learning series
Mongo learning series Mongo learning series
Mongo learning series
 
Drupal 8 preview_slideshow
Drupal 8 preview_slideshowDrupal 8 preview_slideshow
Drupal 8 preview_slideshow
 
OpenERP Technical Memento V0.7.3
OpenERP Technical Memento V0.7.3OpenERP Technical Memento V0.7.3
OpenERP Technical Memento V0.7.3
 
Mini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico CesMini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico Ces
 
django
djangodjango
django
 

Último

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 

Último (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

Web application development with Django framework

  • 1. Web Application Development Django Framework Fabrizio Lapiello IT Eng. Student http://flapiello.com
  • 2. Table of contents “Step by Step” 2
  • 3. Table of contents “Step by Step” Step 0: Django Introduction Step 1: Admin Panel Step 2: URL Step 3: Creating an application 2
  • 5. Step 0 Introduction: Django Framework 0) The Framework 1) MTV Pattern 2) DBMS 3) Setup 4) “Hello World” 4.1) Creating and compiling 4.2) Creating a View 3
  • 7. The Framework: What is Django? Django is a great framework for building Web 2.0 applications! It 'was designed to improve development time and quality. http://www.djangoproject.org 4
  • 9. MTV Pattern “Model-Template-View” A pattern that helps to separate the user interface level from the other parts of the system. Model - contains classes whose instances represent the data to display and manipulate. Template - contains objects that control and manage user interaction with the model and view layers. View - contains the objects used in the UI to display the data in the model. 5
  • 10. DBMS “Database management system” Some of the most well-known DBMS used in Django: 6
  • 11. DBMS “Database management system” Some of the most well-known DBMS used in Django: 6
  • 13. Prior Knowledge ...that’s all! 7
  • 14. Good reasons to learn Python Well-known companies have adopted it for their business: 8
  • 15. Good reasons to learn Python Well-known companies have adopted it for their business: 8
  • 16. Setup 9
  • 17. Setup Download: http://www.djangoproject.com/download/ Setup Guide: http://docs.djangoproject.com/en/dev/intro/install/ Official Documentation: http://docs.djangoproject.com/ 9
  • 19. Creating and compiling project $ django-admin.py startproject hello -> __Init__.py manage.py settings.py urls.py $ python manage.py runserver -> 0 Error Found http://127.0.0.1:8000 -> Worked!! 10
  • 20. Creating a view First Step 11
  • 21. Creating a view First Step First of all combining a URL to a view -> http://127.0.0.1:8000/hello Open the file urls.py and insert the following string as the last parameter: -> (r’^hello/$’, “views.hello”) 11
  • 22. Creating a view First Step First of all combining a URL to a view -> http://127.0.0.1:8000/hello Open the file urls.py and insert the following string as the last parameter: -> (r’^hello/$’, “views.hello”) 11
  • 23. Creating a view First Step First of all combining a URL to a view -> http://127.0.0.1:8000/hello Open the file urls.py and insert the following string as the last parameter: -> (r’^hello/$’, “views.hello”) Regular expression that indicates the beginning and the end of the URL. 11
  • 24. Creating a view First Step First of all combining a URL to a view -> http://127.0.0.1:8000/hello Open the file urls.py and insert the following string as the last parameter: -> (r’^hello/$’, “views.hello”) Regular expression that indicates the beginning and the end of the URL. 11
  • 25. Creating a view First Step First of all combining a URL to a view -> http://127.0.0.1:8000/hello Open the file urls.py and insert the following string as the last parameter: -> (r’^hello/$’, “views.hello”) Regular expression that indicates the beginning Combining Url/Vista and the end of the URL. 11
  • 26. Creating a view Second Step The view is simply a Python method that returns the data. In the root of the project we create the views.py file and insert the following method: from django.http import HttpResponse def hello(request): return HttpResponse(“Hello World”) Now type in a terminal: $ python manage.py runserver 12
  • 28. Step 1 Admin Panel 0) Creating applications 1) Creating models 2) Add a Database 3) ORM 4) Creating Admin Panel 13
  • 29. Creating Applications Is good practice to structure the project into sub-applications in order to have greater control over the entire system to be developed! $ python manage.py startapp test If there aren't errors in the root of the project should have a folder named "test" with the following files inside __init__.py models.py views.py Inatalled_Apps indicate the presence in the settings.py file, application "test" by simply inserting his name in quotes at the bottom of the list. 14
  • 30. Creating models Change the models.py file in the folder "test "... from django.db import models class Persona (models.Model): nome = models.CharField(max_length=50) cognome = models.CharField(max_length=50) def __unicode__(self): return u"%s %s" % (self.nome, self.cognome) class Meta: verbose_name_plural ="Persone" 15
  • 31. Add a Database Edit the settings.py file in the following way: DATABASES = { 'default': { 'ENGINE': 'sqlite3', #NAME del dbms es (oracle, mysql etc..) 'NAME': 'test.db', #DB NAME 'USER': '', #USERNAME 'PASSWORD': '', #Password 'HOST': '', #DMBS ADDRESS 'PORT': '', #PORT } } 16
  • 33. ORM “Object-Relational Mapping” An ORM is a kind of linker between objects and relational databases. 17
  • 34. ORM “Object-Relational Mapping” An ORM is a kind of linker between objects and relational databases. Through this linker the created objects with a high-level language are included in the relational database. 17
  • 35. ORM “Object-Relational Mapping” An ORM is a kind of linker between objects and relational databases. Through this linker the created objects with a high-level language are included in the relational database. 17
  • 36. ORM “Object-Relational Mapping” An ORM is a kind of linker between objects and relational databases. Through this linker the created objects with a high-level language are included in the relational database. 17
  • 37. ORM “Object-Relational Mapping” An ORM is a kind of linker between objects and relational databases. Through this linker the created objects with a high-level language are included in the relational database. $ python manage.py syncdb 17
  • 38. Creating Admin Panel First Step Open the file settings.py INSTALLED_APPS and insert in the application for the board of directors as follows: INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.admin', ) 18
  • 39. Creating Admin Panel Second Step Associate a URL to the application, then edit the urls.py file as follows: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), (r'^hello/$', "views.hello"), ) 19
  • 40. Creating Admin Panel Second Step Associate a URL to the application, then edit the urls.py file as follows: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', ! (r'^admin/', include(admin.site.urls)), là (r'^hello/$', "views.hello"), oi ) E t V 19
  • 42. Step 2 URL 0) URL 1) Creating an URL 20
  • 43. URL Uniform Resource Locator Benefit of having "ordered" URL - Easy to remember - Palatability by search engines - Durable Example: 1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17 2) http://nomedominio.com/blog 21
  • 44. URL Uniform Resource Locator Benefit of having "ordered" URL - Easy to remember - Palatability by search engines - Durable Example: 1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17 2) http://nomedominio.com/blog 21
  • 45. URL Uniform Resource Locator Benefit of having "ordered" URL - Easy to remember - Palatability by search engines - Durable Example: 1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17 2) http://nomedominio.com/blog 21
  • 46. URL Uniform Resource Locator Benefit of having "ordered" URL - Easy to remember - Palatability by search engines - Durable n g! yi r rif Ho Example: 1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17 2) http://nomedominio.com/blog 21
  • 47. URL Uniform Resource Locator Benefit of having "ordered" URL - Easy to remember - Palatability by search engines - Durable n g! yi r rif Ho Example: 1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17 2) http://nomedominio.com/blog 21
  • 48. URL Uniform Resource Locator Benefit of having "ordered" URL - Easy to remember - Palatability by search engines - Durable n g! yi r rif Ho Example: 1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17 2) http://nomedominio.com/blog to be rep lac ed 21
  • 49. URL Uniform Resource Locator Benefit of having "ordered" URL - Easy to remember - Palatability by search engines - Durable n g! yi r rif Ho Example: 1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17 2) http://nomedominio.com/blog to be rep lac ed 21
  • 50. URL Uniform Resource Locator Benefit of having "ordered" URL - Easy to remember - Palatability by search engines - Durable n g! yi r rif Ho Example: 1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17 2) http://nomedominio.com/blog to be rep lac ed 21
  • 51. URL Uniform Resource Locator Benefit of having "ordered" URL - Easy to remember - Palatability by search engines - Durable n g! yi r rif Ho Example: 1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17 2) http://nomedominio.com/blog to be rep lac ed 21
  • 52. URL Uniform Resource Locator Benefit of having "ordered" URL - Easy to remember - Palatability by search engines - Durable n g! yi r rif Ho Example: 1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17 2) http://nomedominio.com/blog to be rep lac ed 21
  • 53. URL Uniform Resource Locator Benefit of having "ordered" URL - Easy to remember - Palatability by search engines - Durable n g! yi r rif Ho Example: 1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17 2) http://nomedominio.com/blog to be rep lac ed 21
  • 54. URL Uniform Resource Locator Benefit of having "ordered" URL - Easy to remember - Palatability by search engines - Durable n g! yi r rif Ho Example: 1) http://nomedominio.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=17 2) http://nomedominio.com/blog to be rep lac ed 21
  • 55. Creating URL To create a URL like the following -> http://127.0.0.1:8000/hello you have to combine the view of the URL, so, you have to open the file urls.py and insert the following string as the last parameter: -> (r’^hello/$’, “views.hello”) 22
  • 56. Creating URL To create a URL like the following -> http://127.0.0.1:8000/hello you have to combine the view of the URL, so, you have to open the file urls.py and insert the following string as the last parameter: -> (r’^hello/$’, “views.hello”) 22
  • 57. Creating URL To create a URL like the following -> http://127.0.0.1:8000/hello you have to combine the view of the URL, so, you have to open the file urls.py and insert the following string as the last parameter: -> (r’^hello/$’, “views.hello”) 22
  • 58. Creating URL To create a URL like the following -> http://127.0.0.1:8000/hello you have to combine the view of the URL, so, you have to open the file urls.py and insert the following string as the last parameter: -> (r’^hello/$’, “views.hello”) Regular expression that indicates the beginning and the end of the URL. 22
  • 59. Creating URL To create a URL like the following -> http://127.0.0.1:8000/hello you have to combine the view of the URL, so, you have to open the file urls.py and insert the following string as the last parameter: -> (r’^hello/$’, “views.hello”) Regular expression that indicates the beginning Combining Url/Vista and the end of the URL. 22
  • 60. Step 3 Creating an application 23
  • 61. Step 3 Creating an application DEMO 23
  • 62.
  • 63. Contacts A Q F Fabrizio Lapiello IT Eng. Student Email: flapiello@aol.com Web: http://lfapiello.com

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n