SlideShare a Scribd company logo
1 of 31
Download to read offline
A Quick Overview
A bit about me

•   Programmer @ 5Q Communications
•   Hack on Django mostly full-time
•   Dozen+ sites in production
•   Calvin grad
A bit about Django

•   Named after Django Reinhart, jazz guitarist
•   Python 2.3+ (Not 3.x yet, afiak)
•   BSD license
•   djangoproject.com
•   Current release: 1.1
Who uses it?
•   NASA
•   PBS
•   NY Times
•   LA Times
•   National Geographic
•   Discovery Channel
Features

•   Object-Relational     •   i18n/unicode support
    Mapper
                          •   Cache framework
•   MVC architecture
                          •   Testing framework
•   Templating Language
                          •   Great docs (650+ pages)
•   “Automatic” admins
                          •   Friendly community
•   Elegant urls
More Features

•   Jython support        •   Built-in RSS/ATOM
•   Geospacial content    •   Built-in site maps
    (via GeoDjango)
                          •   Send emails easily
•   Built-in dev server
                          •   “Signal” hooks
•   Nice support
                          •   Solid security emphasis
    for forms
Projects and Apps
Settings: database,               App   Live anywhere in your
email, caching, etc.   Project          PYTHONPATH
                                  App


      HTML, CSS,                  App
      images, etc. Templates
                       & Assets   App
Typical Project Layout
       project/
         __init__.py
         settings.py
         manage.py
         urls.py
         templates/
         static/
         staff_members/
            __init__.py
            models.py
            admin.py
            views.py
            urls.py
            tests.py
            templates/
Typical App Workflow

1. Create app
2. Create models.py and admin.py
3. ‘python manage.py syncdb’
4. Create urls.py and views.py
class StaffMemberGroup(models.Model):
   name = models.CharField(blank=True, max_length=100)
   order = models.IntegerField(blank=True, null=True)

class StaffMember(models.Model):
   first_name = models.CharField(max_length=100)
   last_name = models.CharField(max_length=100)
   title = models.CharField(blank=True, max_length=100)
   bio = models.TextField(blank=True)
   image = models.FileField(upload_to='bio_images', blank=True)
   email = models.EmailField()
   published = models.BooleanField()
   staff_group = models.ForeignKey(StaffMemberGroup)
python manage.py syncdb

1. Create tables
2. Create basic indexes
3. Create intermediate tables
   for m2m relationships
bob = StaffMember(first_name=”Bob”, last_name=”Smith”)

members = StaffMember.objects.all()

ordered_members =
 StaffMember.objects.all().order_by(‘last_name’)

published_members =
 StaffMember.objects.filter(published=True)
groups = StaffMemberGroup.objects.all()

for group in groups:
  print group.name
    for member in group.staffmember_set.all():
       print member.first_name
class StaffMemberAdmin(admin.ModelAdmin):
   list_display = ('last_name', 'first_name', 'email', 'published')
   list_filter = ('published', 'staff_group')
   search_fields = ('first_name', 'last_name', 'bio', 'title', 'email')
   fieldsets = (
       (None, {
           'fields': (('first_name', 'last_name'), 'title', 'email', 'image', 'bio'),
           'description': '',
       }),
       ('Options', {
           'fields': ('published', 'staff_group'),
       })
   )
admin.site.register(StaffMember, StaffMemberAdmin)
project urls.py
urlpatterns = patterns('',
   (r'^staff_members/', include('grpug.staff_members.urls')),
   (r'^admin/doc/', include('django.contrib.admindocs.urls')),
   (r'^admin/(.*)', admin.site.root),
)


staff_members app urls.py:
urlpatterns = patterns('grpug.staff_members.views',
   url(r'^$', 'show_staff_members', name='staff-members'),
)
def show_staff_members(request):
  groups = StaffMemberGroup.objects.all()
  return render_to_response(
     'staff_member.html',
     {'groups': groups}
  )
staff_member.html
{% for group in groups %}
  <h2>{{group.name}}</h2>
  <ul>
     {% for member in group.staffmember_set.all %}
        <li>
        <h3>{{member.first_name}} {{member.last_name}}</h3>
        <p>{{member.bio}}</p>
        </li>
     {% endfor %}
  </ul>
{% endfor %}
staff_member.html
{% extends ‘base_site.html’ %}

  {% block content %}
  {% for group in groups %}
    <h2>{{group.name}}</h2>
    <ul>
       {% for member in group.staffmember_set.all %}
          <li>
          <h3>{{member.first_name}} {{member.last_name}}</h3>
          <p>{{member.bio}}</p>
          </li>
       {% endfor %}
    </ul>
  {% endfor %}
{% endblock content %}
base_site.html
  <html>
  <body>
    {% block content %}
    {% endblock content %}
  </body>
  </html>
Middleware

•   process_request(self, request)
•   process_view(self, request, view_func,
      view_args, view_kwargs)
•   process_response(self, request, response)
•   process_exception(self, request, exception)
Testing Framework

•   doctests
•   unit tests
•   helpful stuff: fixtures, email test, “client”

    c = Client()
    response = c.post(‘/login’, user_dict)
Some Warts
•   No support for           •   REST/SOAP
    multiple databases           support lacking
•   Poor environment         •   “Explicit” but still tightly
    support (think rails)        coupled for some things
•   Template logic tags      •   No integrated
    below average                deployment toolchain
•   No built-in migrations   •   CMS extras lacking
                                 (wysiwyg, file browser...)
•   Too big?
Rest of the stack

•   Databases        •       Deployment
    •   SQLite           •    mod_python
    •   MySQL            •    mod_wsgi
    •   Postgresql       •    fast cgi
    •   Oracle
Tips
•   virtualenv is your friend
•   default settings.py is about 50% of what a
    production site ends up requiring
•   local_settings.py
•   Don’t be afraid of lots of apps
•   ‘South’ is a solid migrations tool
Docs, Books, People

•   docs.djangoproject.com
•   djangobook.com
•   djangosnippets.com
•   djangopeople.net
•   djangosites.org
Code Samples


•   http://bitbucket.org/btol45/grpug-example/

More Related Content

What's hot

Gae Meets Django
Gae Meets DjangoGae Meets Django
Gae Meets Django
fool2nd
 
A gentle intro to the Django Framework
A gentle intro to the Django FrameworkA gentle intro to the Django Framework
A gentle intro to the Django Framework
Ricardo Soares
 
The Best (and Worst) of Django
The Best (and Worst) of DjangoThe Best (and Worst) of Django
The Best (and Worst) of Django
Jacob Kaplan-Moss
 
Django and Mongoengine
Django and MongoengineDjango and Mongoengine
Django and Mongoengine
austinpublic
 

What's hot (20)

Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Tango with django
Tango with djangoTango with django
Tango with django
 
The Django Book - Chapter 5: Models
The Django Book - Chapter 5: ModelsThe Django Book - Chapter 5: Models
The Django Book - Chapter 5: Models
 
Building a Dynamic Website Using Django
Building a Dynamic Website Using DjangoBuilding a Dynamic Website Using Django
Building a Dynamic Website Using Django
 
Gae Meets Django
Gae Meets DjangoGae Meets Django
Gae Meets Django
 
Making Django and NoSQL Play Nice
Making Django and NoSQL Play NiceMaking Django and NoSQL Play Nice
Making Django and NoSQL Play Nice
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction Django
 
Django
DjangoDjango
Django
 
Django a whirlwind tour
Django   a whirlwind tourDjango   a whirlwind tour
Django a whirlwind tour
 
A gentle intro to the Django Framework
A gentle intro to the Django FrameworkA gentle intro to the Django Framework
A gentle intro to the Django Framework
 
Intro to Web Development Using Python and Django
Intro to Web Development Using Python and DjangoIntro to Web Development Using Python and Django
Intro to Web Development Using Python and Django
 
Selenium&amp;scrapy
Selenium&amp;scrapySelenium&amp;scrapy
Selenium&amp;scrapy
 
Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!
 
The Best (and Worst) of Django
The Best (and Worst) of DjangoThe Best (and Worst) of Django
The Best (and Worst) of Django
 
Djangocon 2014 angular + django
Djangocon 2014 angular + djangoDjangocon 2014 angular + django
Djangocon 2014 angular + django
 
Google App Engine with Gaelyk
Google App Engine with GaelykGoogle App Engine with Gaelyk
Google App Engine with Gaelyk
 
Django REST Framework
Django REST FrameworkDjango REST Framework
Django REST Framework
 
Django and Mongoengine
Django and MongoengineDjango and Mongoengine
Django and Mongoengine
 
Django Mongodb Engine
Django Mongodb EngineDjango Mongodb Engine
Django Mongodb Engine
 
Geotalk presentation
Geotalk presentationGeotalk presentation
Geotalk presentation
 

Viewers also liked

Viewers also liked (12)

Jumpstart Django
Jumpstart DjangoJumpstart Django
Jumpstart Django
 
Free django
Free djangoFree django
Free django
 
Getting Started With Django
Getting Started With DjangoGetting Started With Django
Getting Started With Django
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
Django introduction
Django introductionDjango introduction
Django introduction
 
Django for Beginners
Django for BeginnersDjango for Beginners
Django for Beginners
 
12 tips on Django Best Practices
12 tips on Django Best Practices12 tips on Django Best Practices
12 tips on Django Best Practices
 
Django Best Practices
Django Best PracticesDjango Best Practices
Django Best Practices
 
Python Presentation
Python PresentationPython Presentation
Python Presentation
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and Django
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 

Similar to Django Overview

GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
Yared Ayalew
 
Python & Django TTT
Python & Django TTTPython & Django TTT
Python & Django TTT
kevinvw
 
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Lucidworks
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
Gavin Roy
 
Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGent
kevinvw
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
Acquia
 
Open Social In The Enterprise
Open Social In The EnterpriseOpen Social In The Enterprise
Open Social In The Enterprise
Tim Moore
 

Similar to Django Overview (20)

GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
 
Python & Django TTT
Python & Django TTTPython & Django TTT
Python & Django TTT
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
1.6 米嘉 gobuildweb
1.6 米嘉 gobuildweb1.6 米嘉 gobuildweb
1.6 米嘉 gobuildweb
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojo
 
JS Essence
JS EssenceJS Essence
JS Essence
 
BackboneJS Training - Giving Backbone to your applications
BackboneJS Training - Giving Backbone to your applicationsBackboneJS Training - Giving Backbone to your applications
BackboneJS Training - Giving Backbone to your applications
 
Python - A Comprehensive Programming Language
Python - A Comprehensive Programming LanguagePython - A Comprehensive Programming Language
Python - A Comprehensive Programming Language
 
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
 
Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGent
 
Spring 3 - An Introduction
Spring 3 - An IntroductionSpring 3 - An Introduction
Spring 3 - An Introduction
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
 
Open Social In The Enterprise
Open Social In The EnterpriseOpen Social In The Enterprise
Open Social In The Enterprise
 
12 core technologies you should learn, love, and hate to be a 'real' technocrat
12 core technologies you should learn, love, and hate to be a 'real' technocrat12 core technologies you should learn, love, and hate to be a 'real' technocrat
12 core technologies you should learn, love, and hate to be a 'real' technocrat
 
Introduction to Monsoon PHP framework
Introduction to Monsoon PHP frameworkIntroduction to Monsoon PHP framework
Introduction to Monsoon PHP framework
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Django Overview

  • 2. A bit about me • Programmer @ 5Q Communications • Hack on Django mostly full-time • Dozen+ sites in production • Calvin grad
  • 3.
  • 4. A bit about Django • Named after Django Reinhart, jazz guitarist • Python 2.3+ (Not 3.x yet, afiak) • BSD license • djangoproject.com • Current release: 1.1
  • 5.
  • 6. Who uses it? • NASA • PBS • NY Times • LA Times • National Geographic • Discovery Channel
  • 7. Features • Object-Relational • i18n/unicode support Mapper • Cache framework • MVC architecture • Testing framework • Templating Language • Great docs (650+ pages) • “Automatic” admins • Friendly community • Elegant urls
  • 8. More Features • Jython support • Built-in RSS/ATOM • Geospacial content • Built-in site maps (via GeoDjango) • Send emails easily • Built-in dev server • “Signal” hooks • Nice support • Solid security emphasis for forms
  • 9. Projects and Apps Settings: database, App Live anywhere in your email, caching, etc. Project PYTHONPATH App HTML, CSS, App images, etc. Templates & Assets App
  • 10. Typical Project Layout project/ __init__.py settings.py manage.py urls.py templates/ static/ staff_members/ __init__.py models.py admin.py views.py urls.py tests.py templates/
  • 11. Typical App Workflow 1. Create app 2. Create models.py and admin.py 3. ‘python manage.py syncdb’ 4. Create urls.py and views.py
  • 12. class StaffMemberGroup(models.Model): name = models.CharField(blank=True, max_length=100) order = models.IntegerField(blank=True, null=True) class StaffMember(models.Model): first_name = models.CharField(max_length=100) last_name = models.CharField(max_length=100) title = models.CharField(blank=True, max_length=100) bio = models.TextField(blank=True) image = models.FileField(upload_to='bio_images', blank=True) email = models.EmailField() published = models.BooleanField() staff_group = models.ForeignKey(StaffMemberGroup)
  • 13. python manage.py syncdb 1. Create tables 2. Create basic indexes 3. Create intermediate tables for m2m relationships
  • 14. bob = StaffMember(first_name=”Bob”, last_name=”Smith”) members = StaffMember.objects.all() ordered_members = StaffMember.objects.all().order_by(‘last_name’) published_members = StaffMember.objects.filter(published=True)
  • 15. groups = StaffMemberGroup.objects.all() for group in groups: print group.name for member in group.staffmember_set.all(): print member.first_name
  • 16. class StaffMemberAdmin(admin.ModelAdmin): list_display = ('last_name', 'first_name', 'email', 'published') list_filter = ('published', 'staff_group') search_fields = ('first_name', 'last_name', 'bio', 'title', 'email') fieldsets = ( (None, { 'fields': (('first_name', 'last_name'), 'title', 'email', 'image', 'bio'), 'description': '', }), ('Options', { 'fields': ('published', 'staff_group'), }) ) admin.site.register(StaffMember, StaffMemberAdmin)
  • 17.
  • 18.
  • 19.
  • 20. project urls.py urlpatterns = patterns('', (r'^staff_members/', include('grpug.staff_members.urls')), (r'^admin/doc/', include('django.contrib.admindocs.urls')), (r'^admin/(.*)', admin.site.root), ) staff_members app urls.py: urlpatterns = patterns('grpug.staff_members.views', url(r'^$', 'show_staff_members', name='staff-members'), )
  • 21. def show_staff_members(request): groups = StaffMemberGroup.objects.all() return render_to_response( 'staff_member.html', {'groups': groups} )
  • 22. staff_member.html {% for group in groups %} <h2>{{group.name}}</h2> <ul> {% for member in group.staffmember_set.all %} <li> <h3>{{member.first_name}} {{member.last_name}}</h3> <p>{{member.bio}}</p> </li> {% endfor %} </ul> {% endfor %}
  • 23. staff_member.html {% extends ‘base_site.html’ %} {% block content %} {% for group in groups %} <h2>{{group.name}}</h2> <ul> {% for member in group.staffmember_set.all %} <li> <h3>{{member.first_name}} {{member.last_name}}</h3> <p>{{member.bio}}</p> </li> {% endfor %} </ul> {% endfor %} {% endblock content %}
  • 24. base_site.html <html> <body> {% block content %} {% endblock content %} </body> </html>
  • 25. Middleware • process_request(self, request) • process_view(self, request, view_func, view_args, view_kwargs) • process_response(self, request, response) • process_exception(self, request, exception)
  • 26. Testing Framework • doctests • unit tests • helpful stuff: fixtures, email test, “client” c = Client() response = c.post(‘/login’, user_dict)
  • 27. Some Warts • No support for • REST/SOAP multiple databases support lacking • Poor environment • “Explicit” but still tightly support (think rails) coupled for some things • Template logic tags • No integrated below average deployment toolchain • No built-in migrations • CMS extras lacking (wysiwyg, file browser...) • Too big?
  • 28. Rest of the stack • Databases • Deployment • SQLite • mod_python • MySQL • mod_wsgi • Postgresql • fast cgi • Oracle
  • 29. Tips • virtualenv is your friend • default settings.py is about 50% of what a production site ends up requiring • local_settings.py • Don’t be afraid of lots of apps • ‘South’ is a solid migrations tool
  • 30. Docs, Books, People • docs.djangoproject.com • djangobook.com • djangosnippets.com • djangopeople.net • djangosites.org
  • 31. Code Samples • http://bitbucket.org/btol45/grpug-example/