SlideShare a Scribd company logo
Django Web Framework
     김형용 , 이정민
     Framework 2.1
Django
• High-level Python Web Framework

• Develop fast
• Automate the repetitive stuff
• Follow best practices
History
• Lawrence Journal-World (
  http://www.ljworld.com)
• by World Online
  Developers
  (A...)

• LJWorld.com
• Lawrence.com
• KUsports.com
“Django” 어떻게 읽어요 ?
•   당고 (X)
•   디장고 (X)
•   장고 (?)
•   쟁고 (?)

• Django Reinhardt
Installation
• Python 2.3+
• Database: PostgreSQL, MySQL,
  SQLite3
• Python DB Interface: psycopg,
                       MySQLdb,
  pysqlite
• Django
Install Python
• http://www.python.org/download/releases/
• http://www.python.org/download/releases/

• Windows.. PATH
  – c:python24
  – c:python24scripts (django-admin.py)
Install SQLite3, pysqlite2
• SQLite3
• http://www.sqlite.org/download.html



• pysqlite2
  – http://pysqlite.org/
  – python setup.py install
Install Django (0.95)
• http://www.djangoproject.com/download/
  – tar xvzf Django-0.95.tar.gz
  – cd Django-0.95
  – sudo python setup.py install
Tutorial
Project (site) : framework21


    /admin/
        Application : admin
      Application : admin              Database
   Application : admin




    /blog/                      /phonebook/
    Application : blog        Application : phonebook
startproject
• django-admin.py framework21

framework21
  __init__.py
  manage.py         scripts/*
  settings.py       config/*
  urls.py           routes.rb

 Django              RoR
startapp
cd framework21
./manage.py startapp blog

framework21/phonebook
   __init__.py
   models.py    app/models/*
   templates    app/views/*
   views.py     app/controllers/*
   urls.py
                     RoR
Create Model
• from django.db import models

• class Person(models.Model):
•    name = models.CharField(maxlength=20)
•    phone_number = PhoneNumberField()
•    note = TextField()
•    def __str__(self):
•       return self.name
•    class Admin:
•       pass
Activating model(Application)
• settings.py  INSTALLED_APPS

• manage.py syncdb
Play with Model API
• from phonebook.models import *

• p = Person(name=u’ 김형용’ , phone_number=‘010-123-4567’,
  note=u‘ 안녕하세요 .’)
• p.save() # insert

• p = Person(name=u’ 이정민’ , phone_number=‘010-123-1234’,
  note=u‘9000+ 일 솔로인생’ )
• p.save() # insert

• Person.objects.all() # ‘ 김형용’ , ‘ 이정민’

• p = Person.objects.get(name=‘ 김형용’ )
• p.note += u’ 여자친구 구합니다 .’
• p.save() # update
admin interface.
• settings.py  INSTALLED_APPS

• manage.py syncdb

• manage.py runserver
• http://localhost:8000/
• http://localhost:8000/admin/
URL design
• urls.py

• project-level URL configuration
• application-level URL configuration

• URL -> view(callback)
View
• request, response

• decide which data is presented ,

• delegate to template how the data is
  presented
Stub view


• from django.http import HttpResponse
• def listing(request):
•    objects = Post.objects.all()
•    … template…  pass context (dict)
•    return HttpResponse(…)
Template
• how the data is presented
Template
• {{ variable }}
• {{ variable|filter }} (O)
• {% tag %}
  – {% if … %} … {% endif %}
  – {% for .. in .. %} … {% endfor %}



• {% extends “base.html %}
Django
URL
Resolver
URL
                    Resolver

blog/urls.py

urlpatterns = patterns(‘blog.views',
    …
    (r'^blog/$',                  ‘post_list'),
    (r'^blog/new/$',              ‘post_new'),
    (r'^blog/(?P<post_id>d+)/$', ‘post_detail'),
    …
URL
                    Resolver

blog/urls.py

urlpatterns = patterns('blog.views',
    …
    (r'^blog/$',                  ‘post_list'),
    (r'^blog/new/$',              ‘post_new'),
    (r'^blog/(?P<post_id>d+)/$', ‘post_detail'),
    …
URL
                    Resolver
                                       view

blog/urls.py

urlpatterns = patterns('blog.views',
    …
    (r'^blog/$',                  ‘post_list'),
    (r'^blog/new/$',              ‘post_new'),
    (r'^blog/(?P<post_id>d+)/$', ‘post_detail'),
    …



               blog.views.post_detail
URL
                    Resolver
                                       view

blog/urls.py

urlpatterns = patterns('blog.views',
    …
    (r'^blog/$',                  ‘post_list'),
    (r'^blog/new/$',              ‘post_new'),
    (r'^blog/(?P<post_id>d+)/$', ‘post_detail'),
    …



               blog.views.post_detail(post_id=‘2’)
URL
                       Resolver           view

blog/views.py

def post_detail(request, post_id):
    post = Blog.objects.get(pk=post_id)
    …




                blog.views.post_detail(post_id=‘2’)
model
                         URL
                       Resolver           view

blog/views.py

def post_detail(request, post_id):
    post = Post.objects.get(pk=post_id)
    …
URL
                       Resolver        view
                                                   Django
blog/views.py                                     template
def post_detail(request, post_id):
    post = Blog.objects.get(pk=post_id)
    t = loader.get_template(‘blog_detail.html’)
    …



                                       blog/templates/blog_detail.html
URL
                       Resolver        view
                                                   Django
blog/views.py                                     template
def post_detail(request, post_id):
    post = Blog.objects.get(pk=post_id)
    t = loader.get_template(‘blog_detail.html’)
    c = Context({‘post’: post})
    html = t.render(c)
    …

                                       blog/templates/blog_detail.html
URL
                         Resolver        view
                                                   Django
blog/templates/blog_detail.html                   template
 <h1> {{ post.title }} </h1>
 <p> {{ post.content|restructuredText }} </p>


 Comments:
 <ul>
 {% for comment in post.comments %}
      <li> {{ comment.who }}:
           {{ comment.content }} </li>
 {% endfor %}
 </ul>




                                         Context({‘post’: post})
URL
                        Resolver        view
                                                  Django
blog/templates/blog_detail.html                  template
 <h1> {{ post.title }} </h1>
 <p> {{ post.content|restructuredText }} </p>


 Comments:
 <ul>
 {% for comment in post.comments %}
      <li> {{ comment.who }}:
           {{ comment.content }} </li>
 {% endfor %}
 </ul>                        <h1> 여자친구 구함 </h1>
                              <p> 20 세 이상 신체건강한 대한민국… </p>


                            Comments:
                            <ul>
                                 <li> 이정민 : 좋은 결과 있길바랍니다 . </li>
                            </ul>
URL
                       Resolver        view

blog/views.py

def post_detail(request, post_id):
    post = Blog.objects.get(pk=post_id)
    t = loader.get_template(‘blog_detail.html’)
    c = Context({‘post’: post})
    html = t.render(c)
    return HttpResponse(html)
URL
                            Resolver        view

     blog/views.py

     def post_detail(request, post_id):
         post = Blog.objects.get(pk=post_id)
         t = loader.get_template(‘blog_detail.html’)
         c = Context({‘post’: post})
         html = t.render(c)
         return HttpResponse(html)

OR
URL
                            Resolver        view

     blog/views.py

     def post_detail(request, post_id):
         post = Blog.objects.get(pk=post_id)
         t = loader.get_template(‘blog_detail.html’)
         c = Context({‘post’: post})
         html = t.render(c)
         return HttpResponse(html)

OR

     def post_detail(request, post_id):
         post = Blog.objects.get(pk=post_id)
         return render_to_response(‘blog_detail.html’,
             {‘post’: post})
Django
model
  URL
           view
Resolver
                   Django
                  template
Where is MIDDLEWARE?
                 mid.process_view(request, view_func, view_args, view_kwargs)
mid.process_request(request)

                                                model
                   URL
                                  view
                 Resolver
                                                 Django
                                                template

          mid.process_response(request, response)
Server arrangement
•   Standalone
•   mod_python
•   FastCGI
•   SCGI
•   Twisted
Conclusion
•   Written in python
•   Easy admin page
•   Elegant URL design
•   Template

• Fast, easy, powerful web development
  with Django
이런저런 이야기
•   Guido’s preference
•   Korean Django Community
•   GAVI : Genome Ajax Viewer
•   GMP study

• http://code.djangoproject.com/ticket/2613
Getting Involved
• http://djangoproject.com/documentation/
• http://code.djangoproject.com/



• http://groups.google.com/group/django-user
• http://groups.google.com/group/django-develope
Ad

More Related Content

What's hot (20)

Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
Knoldus Inc.
 
Web development with django - Basics Presentation
Web development with django - Basics PresentationWeb development with django - Basics Presentation
Web development with django - Basics Presentation
Shrinath Shenoy
 
Python-Functions.pptx
Python-Functions.pptxPython-Functions.pptx
Python-Functions.pptx
Karudaiyar Ganapathy
 
laravel.pptx
laravel.pptxlaravel.pptx
laravel.pptx
asif290119
 
Python/Flask Presentation
Python/Flask PresentationPython/Flask Presentation
Python/Flask Presentation
Parag Mujumdar
 
Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UK
José Paumard
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
Karmatechnologies Pvt. Ltd.
 
Django - Python MVC Framework
Django - Python MVC FrameworkDjango - Python MVC Framework
Django - Python MVC Framework
Bala Kumar
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
 
Django
DjangoDjango
Django
Amanpreet Singh
 
Thymeleaf and Spring Controllers.ppt
Thymeleaf and Spring Controllers.pptThymeleaf and Spring Controllers.ppt
Thymeleaf and Spring Controllers.ppt
Patiento Del Mar
 
Java 8-streams-collectors-patterns
Java 8-streams-collectors-patternsJava 8-streams-collectors-patterns
Java 8-streams-collectors-patterns
José Paumard
 
Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)
Pedro Rodrigues
 
Introduction to Django REST Framework, an easy way to build REST framework in...
Introduction to Django REST Framework, an easy way to build REST framework in...Introduction to Django REST Framework, an easy way to build REST framework in...
Introduction to Django REST Framework, an easy way to build REST framework in...
Zhe Li
 
Introduction to django
Introduction to djangoIntroduction to django
Introduction to django
Ilian Iliev
 
Shields Up! Securing React Apps
Shields Up! Securing React AppsShields Up! Securing React Apps
Shields Up! Securing React Apps
Zachary Klein
 
Restful api
Restful apiRestful api
Restful api
Anurag Srivastava
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
Edureka!
 
Angular js
Angular jsAngular js
Angular js
Knoldus Inc.
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)
WebStackAcademy
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
Knoldus Inc.
 
Web development with django - Basics Presentation
Web development with django - Basics PresentationWeb development with django - Basics Presentation
Web development with django - Basics Presentation
Shrinath Shenoy
 
Python/Flask Presentation
Python/Flask PresentationPython/Flask Presentation
Python/Flask Presentation
Parag Mujumdar
 
Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UK
José Paumard
 
Django - Python MVC Framework
Django - Python MVC FrameworkDjango - Python MVC Framework
Django - Python MVC Framework
Bala Kumar
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
 
Thymeleaf and Spring Controllers.ppt
Thymeleaf and Spring Controllers.pptThymeleaf and Spring Controllers.ppt
Thymeleaf and Spring Controllers.ppt
Patiento Del Mar
 
Java 8-streams-collectors-patterns
Java 8-streams-collectors-patternsJava 8-streams-collectors-patterns
Java 8-streams-collectors-patterns
José Paumard
 
Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)
Pedro Rodrigues
 
Introduction to Django REST Framework, an easy way to build REST framework in...
Introduction to Django REST Framework, an easy way to build REST framework in...Introduction to Django REST Framework, an easy way to build REST framework in...
Introduction to Django REST Framework, an easy way to build REST framework in...
Zhe Li
 
Introduction to django
Introduction to djangoIntroduction to django
Introduction to django
Ilian Iliev
 
Shields Up! Securing React Apps
Shields Up! Securing React AppsShields Up! Securing React Apps
Shields Up! Securing React Apps
Zachary Klein
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
Edureka!
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)
WebStackAcademy
 

Viewers also liked (16)

Nutritionists get social - Azmina Govindji
Nutritionists get social - Azmina GovindjiNutritionists get social - Azmina Govindji
Nutritionists get social - Azmina Govindji
AzminaGovindji
 
Brochure COMOS Overview
Brochure  COMOS OverviewBrochure  COMOS Overview
Brochure COMOS Overview
luizcjs1
 
Ore quispe despido
Ore quispe despidoOre quispe despido
Ore quispe despido
Manuel Manuelito Manu
 
Brochure COMOS Portfolio
Brochure COMOS PortfolioBrochure COMOS Portfolio
Brochure COMOS Portfolio
luizcjs1
 
Waterpark
WaterparkWaterpark
Waterpark
bpm297
 
دایره المعارف معاهدات بین المللی حقوق معاهدات معاهده جقوق معاهده (www.bey...
دایره المعارف معاهدات بین المللی  حقوق معاهدات  معاهده  جقوق معاهده  (www.bey...دایره المعارف معاهدات بین المللی  حقوق معاهدات  معاهده  جقوق معاهده  (www.bey...
دایره المعارف معاهدات بین المللی حقوق معاهدات معاهده جقوق معاهده (www.bey...
maysam araee daronkola
 
Ch 2
Ch 2Ch 2
Ch 2
bindas247
 
P.point.i
P.point.iP.point.i
P.point.i
anita_isywah
 
Brochure COMOS Automation
Brochure COMOS AutomationBrochure COMOS Automation
Brochure COMOS Automation
luizcjs1
 
Invierea domnului
Invierea domnuluiInvierea domnului
Invierea domnului
balajnicusor
 
Brochure COMOS Platform
Brochure COMOS PlatformBrochure COMOS Platform
Brochure COMOS Platform
luizcjs1
 
Brochure COMOS Operations
Brochure COMOS OperationsBrochure COMOS Operations
Brochure COMOS Operations
luizcjs1
 
M.a.d comprehensive lists of international multilateral treaties (law of trea...
M.a.d comprehensive lists of international multilateral treaties (law of trea...M.a.d comprehensive lists of international multilateral treaties (law of trea...
M.a.d comprehensive lists of international multilateral treaties (law of trea...
maysam araee daronkola
 
Famous Criminal Presentation - John List - Ms Chang
Famous Criminal Presentation - John List - Ms ChangFamous Criminal Presentation - John List - Ms Chang
Famous Criminal Presentation - John List - Ms Chang
Fabian Torres
 
Nutritionists get social - Azmina Govindji
Nutritionists get social - Azmina GovindjiNutritionists get social - Azmina Govindji
Nutritionists get social - Azmina Govindji
AzminaGovindji
 
Brochure COMOS Overview
Brochure  COMOS OverviewBrochure  COMOS Overview
Brochure COMOS Overview
luizcjs1
 
Brochure COMOS Portfolio
Brochure COMOS PortfolioBrochure COMOS Portfolio
Brochure COMOS Portfolio
luizcjs1
 
Waterpark
WaterparkWaterpark
Waterpark
bpm297
 
دایره المعارف معاهدات بین المللی حقوق معاهدات معاهده جقوق معاهده (www.bey...
دایره المعارف معاهدات بین المللی  حقوق معاهدات  معاهده  جقوق معاهده  (www.bey...دایره المعارف معاهدات بین المللی  حقوق معاهدات  معاهده  جقوق معاهده  (www.bey...
دایره المعارف معاهدات بین المللی حقوق معاهدات معاهده جقوق معاهده (www.bey...
maysam araee daronkola
 
Brochure COMOS Automation
Brochure COMOS AutomationBrochure COMOS Automation
Brochure COMOS Automation
luizcjs1
 
Brochure COMOS Platform
Brochure COMOS PlatformBrochure COMOS Platform
Brochure COMOS Platform
luizcjs1
 
Brochure COMOS Operations
Brochure COMOS OperationsBrochure COMOS Operations
Brochure COMOS Operations
luizcjs1
 
M.a.d comprehensive lists of international multilateral treaties (law of trea...
M.a.d comprehensive lists of international multilateral treaties (law of trea...M.a.d comprehensive lists of international multilateral treaties (law of trea...
M.a.d comprehensive lists of international multilateral treaties (law of trea...
maysam araee daronkola
 
Famous Criminal Presentation - John List - Ms Chang
Famous Criminal Presentation - John List - Ms ChangFamous Criminal Presentation - John List - Ms Chang
Famous Criminal Presentation - John List - Ms Chang
Fabian Torres
 
Ad

Similar to Django (20)

Django
DjangoDjango
Django
webuploader
 
Gae Meets Django
Gae Meets DjangoGae Meets Django
Gae Meets Django
fool2nd
 
Django Vs Rails
Django Vs RailsDjango Vs Rails
Django Vs Rails
Sérgio Santos
 
Django
DjangoDjango
Django
Ivan Widodo
 
Django Class-based views (Slovenian)
Django Class-based views (Slovenian)Django Class-based views (Slovenian)
Django Class-based views (Slovenian)
Luka Zakrajšek
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
Joaquim Rocha
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction Django
Wade Austin
 
Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)
Fabien Potencier
 
A Related Matter: Optimizing your webapp by using django-debug-toolbar, selec...
A Related Matter: Optimizing your webapp by using django-debug-toolbar, selec...A Related Matter: Optimizing your webapp by using django-debug-toolbar, selec...
A Related Matter: Optimizing your webapp by using django-debug-toolbar, selec...
Christopher Adams
 
Django workshop : let's make a blog
Django workshop : let's make a blogDjango workshop : let's make a blog
Django workshop : let's make a blog
Pierre Sudron
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable Applications
Alessandro Molina
 
Flask intro - ROSEdu web workshops
Flask intro - ROSEdu web workshopsFlask intro - ROSEdu web workshops
Flask intro - ROSEdu web workshops
Alex Eftimie
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
fishwarter
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
fishwarter
 
PyCon APAC - Django Test Driven Development
PyCon APAC - Django Test Driven DevelopmentPyCon APAC - Django Test Driven Development
PyCon APAC - Django Test Driven Development
Tudor Munteanu
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
fishwarter
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
fishwarter
 
Building a Portfolio With Custom Post Types
Building a Portfolio With Custom Post TypesBuilding a Portfolio With Custom Post Types
Building a Portfolio With Custom Post Types
Alex Blackie
 
DJ-06-Views-Templates.pptx
DJ-06-Views-Templates.pptxDJ-06-Views-Templates.pptx
DJ-06-Views-Templates.pptx
Damien Raczy
 
Django crush course
Django crush course Django crush course
Django crush course
Mohammed El Rafie Tarabay
 
Gae Meets Django
Gae Meets DjangoGae Meets Django
Gae Meets Django
fool2nd
 
Django Class-based views (Slovenian)
Django Class-based views (Slovenian)Django Class-based views (Slovenian)
Django Class-based views (Slovenian)
Luka Zakrajšek
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
Joaquim Rocha
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction Django
Wade Austin
 
Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)
Fabien Potencier
 
A Related Matter: Optimizing your webapp by using django-debug-toolbar, selec...
A Related Matter: Optimizing your webapp by using django-debug-toolbar, selec...A Related Matter: Optimizing your webapp by using django-debug-toolbar, selec...
A Related Matter: Optimizing your webapp by using django-debug-toolbar, selec...
Christopher Adams
 
Django workshop : let's make a blog
Django workshop : let's make a blogDjango workshop : let's make a blog
Django workshop : let's make a blog
Pierre Sudron
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable Applications
Alessandro Molina
 
Flask intro - ROSEdu web workshops
Flask intro - ROSEdu web workshopsFlask intro - ROSEdu web workshops
Flask intro - ROSEdu web workshops
Alex Eftimie
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
fishwarter
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
fishwarter
 
PyCon APAC - Django Test Driven Development
PyCon APAC - Django Test Driven DevelopmentPyCon APAC - Django Test Driven Development
PyCon APAC - Django Test Driven Development
Tudor Munteanu
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
fishwarter
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
fishwarter
 
Building a Portfolio With Custom Post Types
Building a Portfolio With Custom Post TypesBuilding a Portfolio With Custom Post Types
Building a Portfolio With Custom Post Types
Alex Blackie
 
DJ-06-Views-Templates.pptx
DJ-06-Views-Templates.pptxDJ-06-Views-Templates.pptx
DJ-06-Views-Templates.pptx
Damien Raczy
 
Ad

Recently uploaded (20)

How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 

Django

  • 1. Django Web Framework 김형용 , 이정민 Framework 2.1
  • 2. Django • High-level Python Web Framework • Develop fast • Automate the repetitive stuff • Follow best practices
  • 3. History • Lawrence Journal-World ( http://www.ljworld.com) • by World Online Developers (A...) • LJWorld.com • Lawrence.com • KUsports.com
  • 4. “Django” 어떻게 읽어요 ? • 당고 (X) • 디장고 (X) • 장고 (?) • 쟁고 (?) • Django Reinhardt
  • 5. Installation • Python 2.3+ • Database: PostgreSQL, MySQL, SQLite3 • Python DB Interface: psycopg, MySQLdb, pysqlite • Django
  • 6. Install Python • http://www.python.org/download/releases/ • http://www.python.org/download/releases/ • Windows.. PATH – c:python24 – c:python24scripts (django-admin.py)
  • 7. Install SQLite3, pysqlite2 • SQLite3 • http://www.sqlite.org/download.html • pysqlite2 – http://pysqlite.org/ – python setup.py install
  • 8. Install Django (0.95) • http://www.djangoproject.com/download/ – tar xvzf Django-0.95.tar.gz – cd Django-0.95 – sudo python setup.py install
  • 10. Project (site) : framework21 /admin/ Application : admin Application : admin Database Application : admin /blog/ /phonebook/ Application : blog Application : phonebook
  • 11. startproject • django-admin.py framework21 framework21 __init__.py manage.py  scripts/* settings.py  config/* urls.py  routes.rb Django RoR
  • 12. startapp cd framework21 ./manage.py startapp blog framework21/phonebook __init__.py models.py  app/models/* templates  app/views/* views.py  app/controllers/* urls.py RoR
  • 13. Create Model • from django.db import models • class Person(models.Model): • name = models.CharField(maxlength=20) • phone_number = PhoneNumberField() • note = TextField() • def __str__(self): • return self.name • class Admin: • pass
  • 14. Activating model(Application) • settings.py  INSTALLED_APPS • manage.py syncdb
  • 15. Play with Model API • from phonebook.models import * • p = Person(name=u’ 김형용’ , phone_number=‘010-123-4567’, note=u‘ 안녕하세요 .’) • p.save() # insert • p = Person(name=u’ 이정민’ , phone_number=‘010-123-1234’, note=u‘9000+ 일 솔로인생’ ) • p.save() # insert • Person.objects.all() # ‘ 김형용’ , ‘ 이정민’ • p = Person.objects.get(name=‘ 김형용’ ) • p.note += u’ 여자친구 구합니다 .’ • p.save() # update
  • 16. admin interface. • settings.py  INSTALLED_APPS • manage.py syncdb • manage.py runserver • http://localhost:8000/ • http://localhost:8000/admin/
  • 17. URL design • urls.py • project-level URL configuration • application-level URL configuration • URL -> view(callback)
  • 18. View • request, response • decide which data is presented , • delegate to template how the data is presented
  • 19. Stub view • from django.http import HttpResponse • def listing(request): • objects = Post.objects.all() • … template…  pass context (dict) • return HttpResponse(…)
  • 20. Template • how the data is presented
  • 21. Template • {{ variable }} • {{ variable|filter }} (O) • {% tag %} – {% if … %} … {% endif %} – {% for .. in .. %} … {% endfor %} • {% extends “base.html %}
  • 24. URL Resolver blog/urls.py urlpatterns = patterns(‘blog.views', … (r'^blog/$', ‘post_list'), (r'^blog/new/$', ‘post_new'), (r'^blog/(?P<post_id>d+)/$', ‘post_detail'), …
  • 25. URL Resolver blog/urls.py urlpatterns = patterns('blog.views', … (r'^blog/$', ‘post_list'), (r'^blog/new/$', ‘post_new'), (r'^blog/(?P<post_id>d+)/$', ‘post_detail'), …
  • 26. URL Resolver view blog/urls.py urlpatterns = patterns('blog.views', … (r'^blog/$', ‘post_list'), (r'^blog/new/$', ‘post_new'), (r'^blog/(?P<post_id>d+)/$', ‘post_detail'), … blog.views.post_detail
  • 27. URL Resolver view blog/urls.py urlpatterns = patterns('blog.views', … (r'^blog/$', ‘post_list'), (r'^blog/new/$', ‘post_new'), (r'^blog/(?P<post_id>d+)/$', ‘post_detail'), … blog.views.post_detail(post_id=‘2’)
  • 28. URL Resolver view blog/views.py def post_detail(request, post_id): post = Blog.objects.get(pk=post_id) … blog.views.post_detail(post_id=‘2’)
  • 29. model URL Resolver view blog/views.py def post_detail(request, post_id): post = Post.objects.get(pk=post_id) …
  • 30. URL Resolver view Django blog/views.py template def post_detail(request, post_id): post = Blog.objects.get(pk=post_id) t = loader.get_template(‘blog_detail.html’) … blog/templates/blog_detail.html
  • 31. URL Resolver view Django blog/views.py template def post_detail(request, post_id): post = Blog.objects.get(pk=post_id) t = loader.get_template(‘blog_detail.html’) c = Context({‘post’: post}) html = t.render(c) … blog/templates/blog_detail.html
  • 32. URL Resolver view Django blog/templates/blog_detail.html template <h1> {{ post.title }} </h1> <p> {{ post.content|restructuredText }} </p> Comments: <ul> {% for comment in post.comments %} <li> {{ comment.who }}: {{ comment.content }} </li> {% endfor %} </ul> Context({‘post’: post})
  • 33. URL Resolver view Django blog/templates/blog_detail.html template <h1> {{ post.title }} </h1> <p> {{ post.content|restructuredText }} </p> Comments: <ul> {% for comment in post.comments %} <li> {{ comment.who }}: {{ comment.content }} </li> {% endfor %} </ul> <h1> 여자친구 구함 </h1> <p> 20 세 이상 신체건강한 대한민국… </p> Comments: <ul> <li> 이정민 : 좋은 결과 있길바랍니다 . </li> </ul>
  • 34. URL Resolver view blog/views.py def post_detail(request, post_id): post = Blog.objects.get(pk=post_id) t = loader.get_template(‘blog_detail.html’) c = Context({‘post’: post}) html = t.render(c) return HttpResponse(html)
  • 35. URL Resolver view blog/views.py def post_detail(request, post_id): post = Blog.objects.get(pk=post_id) t = loader.get_template(‘blog_detail.html’) c = Context({‘post’: post}) html = t.render(c) return HttpResponse(html) OR
  • 36. URL Resolver view blog/views.py def post_detail(request, post_id): post = Blog.objects.get(pk=post_id) t = loader.get_template(‘blog_detail.html’) c = Context({‘post’: post}) html = t.render(c) return HttpResponse(html) OR def post_detail(request, post_id): post = Blog.objects.get(pk=post_id) return render_to_response(‘blog_detail.html’, {‘post’: post})
  • 38. model URL view Resolver Django template
  • 39. Where is MIDDLEWARE? mid.process_view(request, view_func, view_args, view_kwargs) mid.process_request(request) model URL view Resolver Django template mid.process_response(request, response)
  • 40. Server arrangement • Standalone • mod_python • FastCGI • SCGI • Twisted
  • 41. Conclusion • Written in python • Easy admin page • Elegant URL design • Template • Fast, easy, powerful web development with Django
  • 42. 이런저런 이야기 • Guido’s preference • Korean Django Community • GAVI : Genome Ajax Viewer • GMP study • http://code.djangoproject.com/ticket/2613
  • 43. Getting Involved • http://djangoproject.com/documentation/ • http://code.djangoproject.com/ • http://groups.google.com/group/django-user • http://groups.google.com/group/django-develope

Editor's Notes

  • #4: World Online 의 개발자들이 Django 를 만듦 . 2 년 동안 위 사이트들과 다른 프로젝트를 만드는데 Django 를 사용함 . 위 사이트들은 newspaper 사이트 . Andrian Holovaty Jacob Kaplan-Moss Simon Willison Wilson Miner
  • #5: 장고 개발자 andrian 이 기타 치는걸 좋아함 . 아마 Django Reinhardt 의 기타 연주법을 좋아하는것에서 이름이 유래됐을것이라고 함 . djangoproject.com 에서 이름의 유래에 대해서 해명 (?) 안하고 있음 Django Reinhardt: 본명 Jean Baptiste Reinhardt. 벨기에 리벨시 출생 . 18 세 때 화상을 입어 왼손 손가락 두 개의 기능을 상실하였으나 , 유랑생활을 하는 동안 기타를 독습하여 1931 년 프랑스 재즈계에 등장 , 1934 년 파리에서 S. 그라펠리 와 함께 ‘ 핫클럽 5 중주단 (Quintette du Hot Club de France) ’ 을 조직하고 독특한 기교와 광시곡 스타일의 기타 솔로로 , 미국에까지 알려졌다 . 1946 년 미국으로 건너가 D. 에린튼악단과 공연하였으며 , 《구름》 등의 작곡으로 뛰어난 재능을 보였다 .
  • #7: 윈도우 사용자라면 next, next, next, .. MacOSX 는 아마 기본적으로 깔릴테고 Linux/BSD 에서는 패키지로 제공 기타 Unix 는 ./configure; make; make install 2.5 에서는 테스트해보지 못했음 . (joke): 사용해보고 잘 되면 알려주세요 ~ =3=3
  • #8: SQLite3: 윈도우라면 zip 파일을 PATH 상의 디렉토리에 풀어주는 것으로 끝 . pysqlite2 - 윈도우라면 .exe 파일 다운받고 클릭 - 기타 : python setup.py install
  • #12: django-admin.py - 프로젝트 / 어플리케이션 생성 - DB 관리 커맨트 - 개발용 웹서버 시작 - 테스트 구동 manage.py: django-admin.py 과 같은 기능 (DJANGO_SETTINGS_MODULE 설정할 필요 없음 ) ( 루비의 scripts/*) settings.py: project 의 전반적인 설정 (DB, Root URL, Application, ..) (Ruby 의 conf/database.yml, conf/environment.rb) urls.py: URL mapping (Ruby 의 routes.rb 보다 세세하게 ...)
  • #13: models.py - ORM views.py - controller , Python callback function for a particular URL MVC - MTV
  • #14: PhoneNumberField, EmailField, URLField 같이 DB 차원의 Low-level … . 이 아닌 사용자입장에서 모델링 가능 .. 적절한 validation 도 자동으로 됨
  • #17: startproject startapp settings.py, urls.py models.py 복사 manage.py syncdb manage.py runserver http://localhost:8000/admin/
  • #21: A template is simply a text file. It can generate any text-based format (HTML, XML, CSV, etc.). A template contains variables , which get replaced with values when the template is evaluated, and tags , which control the logic of the template.
  • #23: 앞부분은 전반적 개념에 대한 설명이었다 …… … 데이터의 흐름 …
  • #33: . -&gt; attribute, method, index, key-value
  • #44: Main site http://djangoproject.com/ code site (trac) http://code.djangoproject.com/