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

Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Djangocolinkingswood
 
The Django Book - Chapter 5: Models
The Django Book - Chapter 5: ModelsThe Django Book - Chapter 5: Models
The Django Book - Chapter 5: ModelsSharon Chen
 
Building a Dynamic Website Using Django
Building a Dynamic Website Using DjangoBuilding a Dynamic Website Using Django
Building a Dynamic Website Using DjangoNathan Eror
 
Gae Meets Django
Gae Meets DjangoGae Meets Django
Gae Meets Djangofool2nd
 
Making Django and NoSQL Play Nice
Making Django and NoSQL Play NiceMaking Django and NoSQL Play Nice
Making Django and NoSQL Play NiceAlex Gaynor
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction DjangoWade Austin
 
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 FrameworkRicardo Soares
 
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 DjangoChariza Pladin
 
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!Eric Palakovich Carr
 
The Best (and Worst) of Django
The Best (and Worst) of DjangoThe Best (and Worst) of Django
The Best (and Worst) of DjangoJacob Kaplan-Moss
 
Djangocon 2014 angular + django
Djangocon 2014 angular + djangoDjangocon 2014 angular + django
Djangocon 2014 angular + djangoNina Zakharenko
 
Google App Engine with Gaelyk
Google App Engine with GaelykGoogle App Engine with Gaelyk
Google App Engine with GaelykChoong Ping Teo
 
Django REST Framework
Django REST FrameworkDjango REST Framework
Django REST FrameworkLoad Impact
 
Django and Mongoengine
Django and MongoengineDjango and Mongoengine
Django and Mongoengineaustinpublic
 

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

Jumpstart Django
Jumpstart DjangoJumpstart Django
Jumpstart Djangoryates
 
Getting Started With Django
Getting Started With DjangoGetting Started With Django
Getting Started With Djangojeff_croft
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2fishwarter
 
Django for Beginners
Django for BeginnersDjango for Beginners
Django for BeginnersJason Davies
 
12 tips on Django Best Practices
12 tips on Django Best Practices12 tips on Django Best Practices
12 tips on Django Best PracticesDavid Arcos
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and DjangoMichael Pirnat
 
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 MinutesMatt Harrison
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to PythonNowell Strite
 

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 EngineYared Ayalew
 
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)Doris Chen
 
國民雲端架構 Django + GAE
國民雲端架構 Django + GAE國民雲端架構 Django + GAE
國民雲端架構 Django + GAEWinston Chen
 
Python & Django TTT
Python & Django TTTPython & Django TTT
Python & Django TTTkevinvw
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPOscar Merida
 
1.6 米嘉 gobuildweb
1.6 米嘉 gobuildweb1.6 米嘉 gobuildweb
1.6 米嘉 gobuildwebLeo Zhou
 
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 dojoFu Cheng
 
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 applicationsJoseph Khan
 
Python - A Comprehensive Programming Language
Python - A Comprehensive Programming LanguagePython - A Comprehensive Programming Language
Python - A Comprehensive Programming LanguageTsungWei Hu
 
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 TornadoGavin Roy
 
Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGentkevinvw
 
Spring 3 - An Introduction
Spring 3 - An IntroductionSpring 3 - An Introduction
Spring 3 - An IntroductionThorsten Kamann
 
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 WebsiteAcquia
 
Open Social In The Enterprise
Open Social In The EnterpriseOpen Social In The Enterprise
Open Social In The EnterpriseTim Moore
 
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' technocratlinoj
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Derek Jacoby
 

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

Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

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/