Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django AUTHORS   Python   Google   3
7                10


    Django   5
Django
PHP   Python
2003
Ruby on Rails
2005
World Online often has only
a matter of hours to take a complicated
Web application from concept to public launch.
…
…
…
DB
URL
DB
URL
DB
URL
DB
URL
DB
URL
DB
URL
85%
http://www2.ljworld.com/




LJWorld   …
http://www2.ljworld.com/
                     2005
Django          Adrian
http://www2.ljworld.com/
                     2005
Django          Adrian
http://www2.ljworld.com/
                     2005
Django          Adrian
http://www2.ljworld.com/
                     2005
Django          Adrian
http://www2.ljworld.com/
                     2005
Django          Adrian
…   …
Django - 次の一歩 gumiStudy#3
27.6
django-admin.py startproject startapp


                                        manage.py
4       settings.py


    4
4       settings.py


    4
4       settings.py


    4
settings.py   INSTALLED_APPS
5                        Web




    blog                                  blog
settings.py   INSTALLED_APPS
5                        Web




    blog                                  blog
10                                           manage.py shell             blog
                                  startapp            gumistudy.blog   blog


manage.py           ./manage.py                          PYTHONPATH             Python Shell
            gumistudy.blog
                                                          manage.py
                    PYTHONPATH                 blog
…
Django
Django
Django - 次の一歩 gumiStudy#3
admindoc
              Django
       view
                       Django BIDI
Django - 次の一歩 gumiStudy#3
RegexValidator
        ■    URLValidator
        ■    validate_email
        ■    validate_slug
        ■    validate_ipv4_address
        ■    validate_comma_separated_integer_list
        ■    MaxValueValidator
        ■    MinValueValidator
        ■    MaxLengthValidator
        ■    MinLengthValidator

                                                     Model
validators                                                   validator
  …
ValidationError raise
                        DRY
CharField Integer
validators               RegexValidator                                 validator
             CharField           SlugField                       Slug               URL
                                DB
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
models
models.py
models
models.py
…
models   import   models
                       meta       app_label
…
models   import   models
                       meta       app_label
Django - 次の一歩 gumiStudy#3
…


                        Entry       django.contrib.auth          User
       Entry   auhtor                     User     Entry
User              entry_set
                                                          User
…


                        Entry       django.contrib.auth          User
       Entry   auhtor                     User     Entry
User              entry_set
                                                          User
django.contrib.auth
                                      django.contrib.contenttypes
ContentType                         django.contrib.auth
django.contrib.auth
                                      django.contrib.contenttypes
ContentType                         django.contrib.auth
memcached
Signal
Signal
                  send
Signal
Signal
                  send
Signal
Signal
                  send
send    sender args


                        connect
          sender args
connect                      sender
send    sender args


                        connect
          sender args
connect                      sender
send    sender args


                        connect
          sender args
connect                      sender
…
Python
Python
Python
Abstract   syncdb
…   Proxy
…   Proxy
O/R Mapper    SQL


O/R Mapper           SQL         SQL
objects
              filter exclude       all
…                             …         all   filter
                              …
objects
              filter exclude       all
…                             …         all   filter
                              …
objects
              filter exclude       all
…                             …         all   filter
                              …
objects
              filter exclude       all
…                             …         all   filter
                              …
F Aggregation
F


        Aggregation             aggregate annotate       aggregate
    annotate                                         Aggregate Annotate
          Queryset
F Aggregation
F


        Aggregation             aggregate annotate       aggregate
    annotate                                         Aggregate Annotate
          Queryset
F Aggregation
F


        Aggregation             aggregate annotate       aggregate
    annotate                                         Aggregate Annotate
          Queryset
DRY
           Queryset               get_query_set


               Entry         public_objects pub_date       Queryset


objects   Manager                                 Django
                         Django
DRY
           Queryset               get_query_set


               Entry         public_objects pub_date       Queryset


objects   Manager                                 Django
                         Django
Django
         Django
Django
         Django
using   using   default
using   using   default
Django                                    DatabaseRouters
DatabaseRouters                                               syncdb


    None          None   Django   DatabaseRouter
default
Django
Django            django.contrib
1:30   )




           bitbucket
1:30   )




           bitbucket
ModelAdmin
   Queryset          Queryset   bulk update
save
ModelAdmin
   Queryset          Queryset   bulk update
save
Django
Django   Ellington   CMS
                                    admin
settings.py            TEMPLATE_LOADERS                 TEMPLATE_DIRS
TEMPLATE_LOADERS       filesystem.Loader app_directories.Loader              TEMPLATE_DIRS
                                                                      TEMPLATE_DIRS
       app_directories.Loader
settings.py            TEMPLATE_LOADERS                 TEMPLATE_DIRS
TEMPLATE_LOADERS       filesystem.Loader app_directories.Loader              TEMPLATE_DIRS
                                                                      TEMPLATE_DIRS
       app_directories.Loader
app_directories.Loader
                     Django                               templates
                                 app_directories.Loader
                     templates
app_directories.Loader
                     Django                               templates
                                 app_directories.Loader
                     templates
app_directories.Loader
                     Django                               templates
                                 app_directories.Loader
                     templates
filesystem.Loader TEMPLATE_DIRS


                             templates
                                         TEMPLATE_DIRS
filesystem.Loader TEMPLATE_DIRS


                             templates
                                         TEMPLATE_DIRS
Django   Django
2
admin/site_base.html                   …
  app_directory.Loader   filesystem.Loader
admin/site_base.html                   …
  app_directory.Loader   filesystem.Loader
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
! <html>
!!! <head>{% block title %}              {% endblock title %}</head>
    <script type="text/javascript" src="common.js"></script>
    {% block custom_js %}{% endblock custom_js %}
!!! <body>
!!! <div id="menu">{% block menu %}{% endblock menu %}</div>
!!! <div id="content">{% block content %}{% endblock content %}</div>
    <div id=”copyright”>{% block copyright %}everes{% endblock %}</div>
!!! </body>
! </html>




! {% extends 'base.html% %}
! {% block title %}{{ block.super }}            {% endblock title %}
! {% block menu %}                      {% endblock menu %}




! {% extends 'app/base.html' %}
! {% block content %}                  {% endblock content %}
! <html>
!!! <head>{% block title %}              {% endblock title %}</head>
    <script type="text/javascript" src="common.js"></script>
    {% block custom_js %}{% endblock custom_js %}
!!! <body>
!!! <div id="menu">{% block menu %}{% endblock menu %}</div>
!!! <div id="content">{% block content %}{% endblock content %}</div>
    <div id=”copyright”>{% block copyright %}everes{% endblock %}</div>
!!! </body>
! </html>




! {% extends 'base.html% %}
! {% block title %}{{ block.super }}            {% endblock title %}
! {% block menu %}                      {% endblock menu %}




! {% extends 'app/base.html' %}
! {% block content %}                  {% endblock content %}
! <html>
!!! <head>{% block title %}              {% endblock title %}</head>
    <script type="text/javascript" src="common.js"></script>
    {% block custom_js %}{% endblock custom_js %}
!!! <body>
!!! <div id="menu">{% block menu %}{% endblock menu %}</div>
!!! <div id="content">{% block content %}{% endblock content %}</div>
    <div id=”copyright”>{% block copyright %}everes{% endblock %}</div>
!!! </body>
! </html>




! {% extends 'base.html% %}
! {% block title %}{{ block.super }}            {% endblock title %}
! {% block menu %}                      {% endblock menu %}




! {% extends 'app/base.html' %}
! {% block content %}                  {% endblock content %}
! <html>
!!! <head>{% block title %}              {% endblock title %}</head>
    <script type="text/javascript" src="common.js"></script>
    {% block custom_js %}{% endblock custom_js %}
!!! <body>
!!! <div id="menu">{% block menu %}{% endblock menu %}</div>
!!! <div id="content">{% block content %}{% endblock content %}</div>
    <div id=”copyright”>{% block copyright %}everes{% endblock %}</div>
!!! </body>
! </html>




! {% extends 'base.html% %}
! {% block title %}{{ block.super }}            {% endblock title %}
! {% block menu %}                      {% endblock menu %}




! {% extends 'app/base.html' %}
! {% block content %}                  {% endblock content %}
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3

More Related Content

Django - 次の一歩 gumiStudy#3

  • 3. Django AUTHORS Python Google 3
  • 4. 7 10 Django 5
  • 6. PHP Python
  • 10. World Online often has only a matter of hours to take a complicated Web application from concept to public launch.
  • 11.
  • 12.
  • 13.
  • 20. 85%
  • 22. http://www2.ljworld.com/ 2005 Django Adrian
  • 23. http://www2.ljworld.com/ 2005 Django Adrian
  • 24. http://www2.ljworld.com/ 2005 Django Adrian
  • 25. http://www2.ljworld.com/ 2005 Django Adrian
  • 26. http://www2.ljworld.com/ 2005 Django Adrian
  • 27.
  • 30. 4 settings.py 4
  • 31. 4 settings.py 4
  • 32. 4 settings.py 4
  • 33. settings.py INSTALLED_APPS 5 Web blog blog
  • 34. settings.py INSTALLED_APPS 5 Web blog blog
  • 35. 10 manage.py shell blog startapp gumistudy.blog blog manage.py ./manage.py PYTHONPATH Python Shell gumistudy.blog manage.py PYTHONPATH blog
  • 36.
  • 40. admindoc Django view Django BIDI
  • 42. RegexValidator ■ URLValidator ■ validate_email ■ validate_slug ■ validate_ipv4_address ■ validate_comma_separated_integer_list ■ MaxValueValidator ■ MinValueValidator ■ MaxLengthValidator ■ MinLengthValidator Model validators validator …
  • 44. CharField Integer validators RegexValidator validator CharField SlugField Slug URL DB
  • 49. … models import models meta app_label
  • 50. … models import models meta app_label
  • 52. Entry django.contrib.auth User Entry auhtor User Entry User entry_set User
  • 53. Entry django.contrib.auth User Entry auhtor User Entry User entry_set User
  • 54. django.contrib.auth django.contrib.contenttypes ContentType django.contrib.auth
  • 55. django.contrib.auth django.contrib.contenttypes ContentType django.contrib.auth
  • 60. send sender args connect sender args connect sender
  • 61. send sender args connect sender args connect sender
  • 62. send sender args connect sender args connect sender
  • 63.
  • 67. Abstract syncdb
  • 68. Proxy
  • 69. Proxy
  • 70. O/R Mapper SQL O/R Mapper SQL SQL
  • 71. objects filter exclude all … … all filter …
  • 72. objects filter exclude all … … all filter …
  • 73. objects filter exclude all … … all filter …
  • 74. objects filter exclude all … … all filter …
  • 75. F Aggregation F Aggregation aggregate annotate aggregate annotate Aggregate Annotate Queryset
  • 76. F Aggregation F Aggregation aggregate annotate aggregate annotate Aggregate Annotate Queryset
  • 77. F Aggregation F Aggregation aggregate annotate aggregate annotate Aggregate Annotate Queryset
  • 78. DRY Queryset get_query_set Entry public_objects pub_date Queryset objects Manager Django Django
  • 79. DRY Queryset get_query_set Entry public_objects pub_date Queryset objects Manager Django Django
  • 80. Django Django
  • 81. Django Django
  • 82. using using default
  • 83. using using default
  • 84. Django DatabaseRouters DatabaseRouters syncdb None None Django DatabaseRouter default
  • 85. Django Django django.contrib
  • 86. 1:30 ) bitbucket
  • 87. 1:30 ) bitbucket
  • 88. ModelAdmin Queryset Queryset bulk update save
  • 89. ModelAdmin Queryset Queryset bulk update save
  • 90. Django Django Ellington CMS admin
  • 91. settings.py TEMPLATE_LOADERS TEMPLATE_DIRS TEMPLATE_LOADERS filesystem.Loader app_directories.Loader TEMPLATE_DIRS TEMPLATE_DIRS app_directories.Loader
  • 92. settings.py TEMPLATE_LOADERS TEMPLATE_DIRS TEMPLATE_LOADERS filesystem.Loader app_directories.Loader TEMPLATE_DIRS TEMPLATE_DIRS app_directories.Loader
  • 93. app_directories.Loader Django templates app_directories.Loader templates
  • 94. app_directories.Loader Django templates app_directories.Loader templates
  • 95. app_directories.Loader Django templates app_directories.Loader templates
  • 96. filesystem.Loader TEMPLATE_DIRS templates TEMPLATE_DIRS
  • 97. filesystem.Loader TEMPLATE_DIRS templates TEMPLATE_DIRS
  • 98. Django Django 2
  • 99. admin/site_base.html … app_directory.Loader filesystem.Loader
  • 100. admin/site_base.html … app_directory.Loader filesystem.Loader
  • 119. ! <html> !!! <head>{% block title %} {% endblock title %}</head> <script type="text/javascript" src="common.js"></script> {% block custom_js %}{% endblock custom_js %} !!! <body> !!! <div id="menu">{% block menu %}{% endblock menu %}</div> !!! <div id="content">{% block content %}{% endblock content %}</div> <div id=”copyright”>{% block copyright %}everes{% endblock %}</div> !!! </body> ! </html> ! {% extends 'base.html% %} ! {% block title %}{{ block.super }} {% endblock title %} ! {% block menu %} {% endblock menu %} ! {% extends 'app/base.html' %} ! {% block content %} {% endblock content %}
  • 120. ! <html> !!! <head>{% block title %} {% endblock title %}</head> <script type="text/javascript" src="common.js"></script> {% block custom_js %}{% endblock custom_js %} !!! <body> !!! <div id="menu">{% block menu %}{% endblock menu %}</div> !!! <div id="content">{% block content %}{% endblock content %}</div> <div id=”copyright”>{% block copyright %}everes{% endblock %}</div> !!! </body> ! </html> ! {% extends 'base.html% %} ! {% block title %}{{ block.super }} {% endblock title %} ! {% block menu %} {% endblock menu %} ! {% extends 'app/base.html' %} ! {% block content %} {% endblock content %}
  • 121. ! <html> !!! <head>{% block title %} {% endblock title %}</head> <script type="text/javascript" src="common.js"></script> {% block custom_js %}{% endblock custom_js %} !!! <body> !!! <div id="menu">{% block menu %}{% endblock menu %}</div> !!! <div id="content">{% block content %}{% endblock content %}</div> <div id=”copyright”>{% block copyright %}everes{% endblock %}</div> !!! </body> ! </html> ! {% extends 'base.html% %} ! {% block title %}{{ block.super }} {% endblock title %} ! {% block menu %} {% endblock menu %} ! {% extends 'app/base.html' %} ! {% block content %} {% endblock content %}
  • 122. ! <html> !!! <head>{% block title %} {% endblock title %}</head> <script type="text/javascript" src="common.js"></script> {% block custom_js %}{% endblock custom_js %} !!! <body> !!! <div id="menu">{% block menu %}{% endblock menu %}</div> !!! <div id="content">{% block content %}{% endblock content %}</div> <div id=”copyright”>{% block copyright %}everes{% endblock %}</div> !!! </body> ! </html> ! {% extends 'base.html% %} ! {% block title %}{{ block.super }} {% endblock title %} ! {% block menu %} {% endblock menu %} ! {% extends 'app/base.html' %} ! {% block content %} {% endblock content %}