SlideShare a Scribd company logo
Pluggable Applications
      DjangoCon 2009

       Nowell Strite
       Shawn Rider
Road Map




•  Background 
•  Current Approaches 
•  Our Use Case / Requirements 
•  A Proposed Solu=on 
•  Some Live Examples 
•  Q & A 
A little background



PBS manages several major internal sites:




                              and more…
A little background



And many of these use Django to some
               degree:
A little background
A little background
PBS needs Django



•  Serving a diverse array of sites 
•  Built on a diverse technical architecture 
•  Many repe==ve components desired by producers 
   and users 
•  Ease of implementa=on is crucial 
•  But highly specific implementa=on details and 
   goals are oIen more important to producers 
Reusable Apps Save the Day



The Reusable App design paKern helps us: 
  –  Easy to share func=onality with other projects 
  –  Quick to get features up and running 
  –  Possible to expand and enhance func=onality 
Reusable Apps Save the Day… Sort of…



The Reusable App design paKern has some 
  limita=ons 
•  Apps are expected to live at one URL  
   (e.g. hKp://example.com/comments/) 
•  Current conven=on of adding ‘extra_context’ 
   params are not sa=sfactory 
•  Conven=onal template replacement is not always 
   flexible enough  
Template Tags to the Rescue



Template Tags allow apps to expose func=onality 
     inside templates for other apps and site 
                   components 
Template Tags to the Rescue … Sort of…



But template tags are also limited: 
  –  Form pos=ng becomes complicated 
  –  Generic inser=on of data into page context can 
     be dangerous 
  –  Addi=onal logic, such as complex permissions 
     checks, are difficult to enforce or bypass via 
     generic template tags 
The Use Case: PBS TeacherLine Peer Connection


Peer Connection features:

1. Access to a robust database of curated resources
2. Community features to allow educators to share and
discuss these resources

Because discussion is so important in this setting, many
objects in Peer Connection support discussions.

Given that the purpose of the site is partially to learn to
use technology, a clean user experience is essential.
The Use Case: PBS TeacherLine Peer Connection


Our Requirements:

•  Sensible URLs that follow our patterns elsewhere on
the site
•  Allow discussions app to interact with other apps and
objects in expected ways
•  Allow posting of data and error handling in the same
location – no redirects to stand-alone pages to fix a
message post.
•  Flexibility to enforce permissions and other variations
of display in an ad-hoc way.
Our Solution: Make the Reusable App Pluggable



By making an app “pluggable” we gain some extra 
  features: 
  –  Apps can be presented at various URLs 
     throughout the site 
  –  Each presenta=on can define context in a clean, 
     DRY manner 
  –  Form pos=ng and error handling can happen in 
     the logical loca=on for the user 
The Use Case: PBS TeacherLine Peer Connection


       Two examples of how discussions appear in Peer
       Connection:




/community/network/pbs-staff/group/tl-technology/discuss/


                                                             /content/module/216/discuss/
The Use Case: PBS TeacherLine Peer Connection


       Two examples of how discussions appear in Peer
       Connection:




/community/network/pbs-staff/group/tl-technology/discuss/


                                                             /content/module/216/discuss/
The Use Case: PBS TeacherLine Peer Connection


       Two examples of how discussions appear in Peer
       Connection:




/community/network/pbs-staff/group/tl-technology/discuss/


                                                             /content/module/216/discuss/
The Use Case: PBS TeacherLine Peer Connection


                Content generated by the pluggable app:




                                                             /content/module/216/discuss/


/community/network/pbs-staff/group/tl-technology/discuss/
The Use Case: PBS TeacherLine Peer Connection


  Content required by the presenting app templates:




                                                             /content/module/216/discuss/


/community/network/pbs-staff/group/tl-technology/discuss/
Make it So




By making our discussions app pluggable, we solved our
problems and fulfilled our requirements.

       But what kind of work does it take to get there?
Make it So




Parts of Pluggable Apps
 •  Pluggable URL definition
 •  Pluggable application views definition
 •  Subclass / instantiation of Pluggable
    application
Pluggable URL Definition




from
pluggables
import
PluggableApp,
url,
include,
patterns

class
ComplaintsApp(PluggableApp):




urlpatterns
=
patterns('complaints.views.traditional',








url(r'^$',
'index',
name='complaints_index'),








url(r'^create/$',
'edit',
name='complaints_create'),








url(r'^(?P<complaint_id>d+)/edit/$',
'edit',

name='complaints_edit'),








url(r'^(?P<complaint_id>d+)/delete/$',
'delete',

name='complaints_delete'),




)
Pluggable Application Views Definition




def
index(request):




complaints
=
Complaint.objects.pluggable(request)




form
=
ComplaintForm()




template
=
request.pluggable.config.get('template’)




base_template
=
request.pluggable.config.get('base_template’)





return
render_to_response(template,
{








'complaints':
complaints,








'form':
form,








'base_template':
base_template,








},
context_instance=RequestContext(request))
Subclass / Instantiation of Pluggable Application


class
SillyWalkComplaintsApp(ComplaintsApp):




def
pluggable_config(self,
request,
walk_slug=None):








return
{'base_template':
'sillywalks/view.html'}





def
pluggable_view_context(self,
request,
walk_slug):








try:












sillywalk
=
SillyWalk.objects.get(slug=walk_slug)








except
SillyWalk.DoesNotExist:












raise
Http404








return
sillywalk





def
pluggable_template_context(self,
request,
walk_slug):








return
{'sillywalk':
request.pluggable.view_context}

complaints_app
=
SillyWalkComplaintsApp('sillywalks')
And Now For Something Completely Different




 Let’s see some live examples…
Thank You For Your Time



Code referenced in this presentation is available at:
          http://bit.ly/django-pluggables

                Nowell Strite
               Twitter: @nowells
             Email: nowell@strite.org

                  Shawn Rider
                 Twitter: @shawnr
          Email: shawn@shawnrider.com

More Related Content

What's hot

jQuery From the Ground Up
jQuery From the Ground UpjQuery From the Ground Up
jQuery From the Ground Up
Kevin Griffin
 
Take your drupal sites offline
Take your drupal sites offlineTake your drupal sites offline
Take your drupal sites offline
Chris Ward
 
Flux architecture
Flux architectureFlux architecture
Flux architecture
Boyan Mihaylov
 
User Macros: Making Your Own Improvements to Confluence - Atlassian Summit 2012
User Macros: Making Your Own Improvements to Confluence - Atlassian Summit 2012User Macros: Making Your Own Improvements to Confluence - Atlassian Summit 2012
User Macros: Making Your Own Improvements to Confluence - Atlassian Summit 2012
Atlassian
 
Reactjs
Reactjs Reactjs
Reactjs
Neha Sharma
 
React introduction
React introductionReact introduction
React introduction
Kashyap Parmar
 
Applying Domain Driven Design on Asp.net MVC – Part 1: Asp.net MVC
Applying Domain Driven Design on Asp.net MVC – Part 1: Asp.net MVCApplying Domain Driven Design on Asp.net MVC – Part 1: Asp.net MVC
Applying Domain Driven Design on Asp.net MVC – Part 1: Asp.net MVC
Mohamed Meligy
 
Single Page WebApp Architecture
Single Page WebApp ArchitectureSingle Page WebApp Architecture
Single Page WebApp Architecture
Morgan Cheng
 
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
eldorina
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web Components
Andrew Rota
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
connectwebex
 
Let's Take Drupal Offline!
Let's Take Drupal Offline!Let's Take Drupal Offline!
Let's Take Drupal Offline!
Dick Olsson
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
 
Rails review
Rails reviewRails review
Rails review
Alan Hecht
 
React & Redux, how to scale?
React & Redux, how to scale?React & Redux, how to scale?
React & Redux, how to scale?
KMS Technology
 
Architecting ASP.NET MVC Applications
Architecting ASP.NET MVC ApplicationsArchitecting ASP.NET MVC Applications
Architecting ASP.NET MVC Applications
Gunnar Peipman
 
Cordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web SkillsCordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web Skills
Clay Ewing
 
Crash Course in AngularJS + Ionic (Deep dive)
Crash Course in AngularJS + Ionic (Deep dive)Crash Course in AngularJS + Ionic (Deep dive)
Crash Course in AngularJS + Ionic (Deep dive)
ColdFusionConference
 
About Flux
About FluxAbout Flux
About Flux
Jooyoung Moon
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applications
SC5.io
 

What's hot (20)

jQuery From the Ground Up
jQuery From the Ground UpjQuery From the Ground Up
jQuery From the Ground Up
 
Take your drupal sites offline
Take your drupal sites offlineTake your drupal sites offline
Take your drupal sites offline
 
Flux architecture
Flux architectureFlux architecture
Flux architecture
 
User Macros: Making Your Own Improvements to Confluence - Atlassian Summit 2012
User Macros: Making Your Own Improvements to Confluence - Atlassian Summit 2012User Macros: Making Your Own Improvements to Confluence - Atlassian Summit 2012
User Macros: Making Your Own Improvements to Confluence - Atlassian Summit 2012
 
Reactjs
Reactjs Reactjs
Reactjs
 
React introduction
React introductionReact introduction
React introduction
 
Applying Domain Driven Design on Asp.net MVC – Part 1: Asp.net MVC
Applying Domain Driven Design on Asp.net MVC – Part 1: Asp.net MVCApplying Domain Driven Design on Asp.net MVC – Part 1: Asp.net MVC
Applying Domain Driven Design on Asp.net MVC – Part 1: Asp.net MVC
 
Single Page WebApp Architecture
Single Page WebApp ArchitectureSingle Page WebApp Architecture
Single Page WebApp Architecture
 
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web Components
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 
Let's Take Drupal Offline!
Let's Take Drupal Offline!Let's Take Drupal Offline!
Let's Take Drupal Offline!
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
Rails review
Rails reviewRails review
Rails review
 
React & Redux, how to scale?
React & Redux, how to scale?React & Redux, how to scale?
React & Redux, how to scale?
 
Architecting ASP.NET MVC Applications
Architecting ASP.NET MVC ApplicationsArchitecting ASP.NET MVC Applications
Architecting ASP.NET MVC Applications
 
Cordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web SkillsCordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web Skills
 
Crash Course in AngularJS + Ionic (Deep dive)
Crash Course in AngularJS + Ionic (Deep dive)Crash Course in AngularJS + Ionic (Deep dive)
Crash Course in AngularJS + Ionic (Deep dive)
 
About Flux
About FluxAbout Flux
About Flux
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applications
 

Viewers also liked

CodeIgniter - PHP MVC Framework by silicongulf.com
CodeIgniter - PHP MVC Framework by silicongulf.comCodeIgniter - PHP MVC Framework by silicongulf.com
CodeIgniter - PHP MVC Framework by silicongulf.com
Christopher Cubos
 
PHP & MVC
PHP & MVCPHP & MVC
PHP & MVC
Chris Weldon
 
The Agile Process - Taming Your Process To Work For You
The Agile Process - Taming Your Process To Work For YouThe Agile Process - Taming Your Process To Work For You
The Agile Process - Taming Your Process To Work For You
Nowell Strite
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
schwebbie
 
ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgniter
mirahman
 
Embracing Distributed Version Control
Embracing Distributed Version ControlEmbracing Distributed Version Control
Embracing Distributed Version Control
Nowell Strite
 
RESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkRESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP Framework
Bo-Yi Wu
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
Nowell Strite
 

Viewers also liked (8)

CodeIgniter - PHP MVC Framework by silicongulf.com
CodeIgniter - PHP MVC Framework by silicongulf.comCodeIgniter - PHP MVC Framework by silicongulf.com
CodeIgniter - PHP MVC Framework by silicongulf.com
 
PHP & MVC
PHP & MVCPHP & MVC
PHP & MVC
 
The Agile Process - Taming Your Process To Work For You
The Agile Process - Taming Your Process To Work For YouThe Agile Process - Taming Your Process To Work For You
The Agile Process - Taming Your Process To Work For You
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
 
ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgniter
 
Embracing Distributed Version Control
Embracing Distributed Version ControlEmbracing Distributed Version Control
Embracing Distributed Version Control
 
RESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkRESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP Framework
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 

Similar to Djangocon 09 Presentation - Pluggable Applications

Progressive Web Apps - deep dive
Progressive Web Apps - deep diveProgressive Web Apps - deep dive
Progressive Web Apps - deep dive
Kenneth Rohde Christiansen
 
H2O World - Building a Smarter Application - Tom Kraljevic
H2O World - Building a Smarter Application - Tom KraljevicH2O World - Building a Smarter Application - Tom Kraljevic
H2O World - Building a Smarter Application - Tom Kraljevic
Sri Ambati
 
DSL (Domain Specific Language) for Maps Mashups
DSL (Domain Specific Language) for Maps MashupsDSL (Domain Specific Language) for Maps Mashups
DSL (Domain Specific Language) for Maps Mashups
aliraza786
 
PWA for PHP Developers
PWA for PHP DevelopersPWA for PHP Developers
PWA for PHP Developers
Ben Marks
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
Saikiran Sheshagiri
 
venki 2.7
venki 2.7venki 2.7
Sam segal resume
Sam segal resumeSam segal resume
Sam segal resume
samuel segal
 
Intro To Django
Intro To DjangoIntro To Django
Intro To Django
Udi Bauman
 
resume_2016_low_rez
resume_2016_low_rezresume_2016_low_rez
resume_2016_low_rez
James Gray
 
Progressive Web Apps - Overview & Getting Started
Progressive Web Apps - Overview & Getting StartedProgressive Web Apps - Overview & Getting Started
Progressive Web Apps - Overview & Getting Started
Gaurav Behere
 
Ramesh Babu Resume Latest
Ramesh Babu Resume LatestRamesh Babu Resume Latest
Ramesh Babu Resume Latest
Ramesh Babu
 
M.M.H.Masud
M.M.H.MasudM.M.H.Masud
M.M.H.Masud
Md. Masud
 
SamSegalResume
SamSegalResumeSamSegalResume
SamSegalResume
samuel segal
 
Reusable Apps
Reusable AppsReusable Apps
Reusable Apps
DjangoCon2008
 
Google Cloud Developer Challenge - GDG Belgaum
Google Cloud Developer Challenge - GDG BelgaumGoogle Cloud Developer Challenge - GDG Belgaum
Google Cloud Developer Challenge - GDG Belgaum
sandeephegde
 
Resume Partha Roy
Resume Partha RoyResume Partha Roy
Resume Partha Roy
Partha Roy
 
The Hitchhiker's Guide to Building a Progressive Web App
The Hitchhiker's Guide to Building a Progressive Web AppThe Hitchhiker's Guide to Building a Progressive Web App
The Hitchhiker's Guide to Building a Progressive Web App
Christopher Nguyen
 
Applied progressive decoupling weather.com, angular, and drupal
Applied progressive decoupling  weather.com, angular, and drupalApplied progressive decoupling  weather.com, angular, and drupal
Applied progressive decoupling weather.com, angular, and drupal
Acquia
 
Resume
ResumeResume
Applications of the REST Principle
Applications of the REST PrincipleApplications of the REST Principle
Applications of the REST Principle
elliando dias
 

Similar to Djangocon 09 Presentation - Pluggable Applications (20)

Progressive Web Apps - deep dive
Progressive Web Apps - deep diveProgressive Web Apps - deep dive
Progressive Web Apps - deep dive
 
H2O World - Building a Smarter Application - Tom Kraljevic
H2O World - Building a Smarter Application - Tom KraljevicH2O World - Building a Smarter Application - Tom Kraljevic
H2O World - Building a Smarter Application - Tom Kraljevic
 
DSL (Domain Specific Language) for Maps Mashups
DSL (Domain Specific Language) for Maps MashupsDSL (Domain Specific Language) for Maps Mashups
DSL (Domain Specific Language) for Maps Mashups
 
PWA for PHP Developers
PWA for PHP DevelopersPWA for PHP Developers
PWA for PHP Developers
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
 
venki 2.7
venki 2.7venki 2.7
venki 2.7
 
Sam segal resume
Sam segal resumeSam segal resume
Sam segal resume
 
Intro To Django
Intro To DjangoIntro To Django
Intro To Django
 
resume_2016_low_rez
resume_2016_low_rezresume_2016_low_rez
resume_2016_low_rez
 
Progressive Web Apps - Overview & Getting Started
Progressive Web Apps - Overview & Getting StartedProgressive Web Apps - Overview & Getting Started
Progressive Web Apps - Overview & Getting Started
 
Ramesh Babu Resume Latest
Ramesh Babu Resume LatestRamesh Babu Resume Latest
Ramesh Babu Resume Latest
 
M.M.H.Masud
M.M.H.MasudM.M.H.Masud
M.M.H.Masud
 
SamSegalResume
SamSegalResumeSamSegalResume
SamSegalResume
 
Reusable Apps
Reusable AppsReusable Apps
Reusable Apps
 
Google Cloud Developer Challenge - GDG Belgaum
Google Cloud Developer Challenge - GDG BelgaumGoogle Cloud Developer Challenge - GDG Belgaum
Google Cloud Developer Challenge - GDG Belgaum
 
Resume Partha Roy
Resume Partha RoyResume Partha Roy
Resume Partha Roy
 
The Hitchhiker's Guide to Building a Progressive Web App
The Hitchhiker's Guide to Building a Progressive Web AppThe Hitchhiker's Guide to Building a Progressive Web App
The Hitchhiker's Guide to Building a Progressive Web App
 
Applied progressive decoupling weather.com, angular, and drupal
Applied progressive decoupling  weather.com, angular, and drupalApplied progressive decoupling  weather.com, angular, and drupal
Applied progressive decoupling weather.com, angular, and drupal
 
Resume
ResumeResume
Resume
 
Applications of the REST Principle
Applications of the REST PrincipleApplications of the REST Principle
Applications of the REST Principle
 

Recently uploaded

9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
ScyllaDB
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
Mydbops
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
christinelarrosa
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
 

Recently uploaded (20)

9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
 

Djangocon 09 Presentation - Pluggable Applications

  • 1. Pluggable Applications DjangoCon 2009 Nowell Strite Shawn Rider
  • 2. Road Map •  Background  •  Current Approaches  •  Our Use Case / Requirements  •  A Proposed Solu=on  •  Some Live Examples  •  Q & A 
  • 3. A little background PBS manages several major internal sites: and more…
  • 4. A little background And many of these use Django to some degree:
  • 7. PBS needs Django •  Serving a diverse array of sites  •  Built on a diverse technical architecture  •  Many repe==ve components desired by producers  and users  •  Ease of implementa=on is crucial  •  But highly specific implementa=on details and  goals are oIen more important to producers 
  • 8. Reusable Apps Save the Day The Reusable App design paKern helps us:  –  Easy to share func=onality with other projects  –  Quick to get features up and running  –  Possible to expand and enhance func=onality 
  • 9. Reusable Apps Save the Day… Sort of… The Reusable App design paKern has some  limita=ons  •  Apps are expected to live at one URL   (e.g. hKp://example.com/comments/)  •  Current conven=on of adding ‘extra_context’  params are not sa=sfactory  •  Conven=onal template replacement is not always  flexible enough  
  • 10. Template Tags to the Rescue Template Tags allow apps to expose func=onality  inside templates for other apps and site  components 
  • 11. Template Tags to the Rescue … Sort of… But template tags are also limited:  –  Form pos=ng becomes complicated  –  Generic inser=on of data into page context can  be dangerous  –  Addi=onal logic, such as complex permissions  checks, are difficult to enforce or bypass via  generic template tags 
  • 12. The Use Case: PBS TeacherLine Peer Connection Peer Connection features: 1. Access to a robust database of curated resources 2. Community features to allow educators to share and discuss these resources Because discussion is so important in this setting, many objects in Peer Connection support discussions. Given that the purpose of the site is partially to learn to use technology, a clean user experience is essential.
  • 13. The Use Case: PBS TeacherLine Peer Connection Our Requirements: •  Sensible URLs that follow our patterns elsewhere on the site •  Allow discussions app to interact with other apps and objects in expected ways •  Allow posting of data and error handling in the same location – no redirects to stand-alone pages to fix a message post. •  Flexibility to enforce permissions and other variations of display in an ad-hoc way.
  • 14. Our Solution: Make the Reusable App Pluggable By making an app “pluggable” we gain some extra  features:  –  Apps can be presented at various URLs  throughout the site  –  Each presenta=on can define context in a clean,  DRY manner  –  Form pos=ng and error handling can happen in  the logical loca=on for the user 
  • 15. The Use Case: PBS TeacherLine Peer Connection Two examples of how discussions appear in Peer Connection: /community/network/pbs-staff/group/tl-technology/discuss/ /content/module/216/discuss/
  • 16. The Use Case: PBS TeacherLine Peer Connection Two examples of how discussions appear in Peer Connection: /community/network/pbs-staff/group/tl-technology/discuss/ /content/module/216/discuss/
  • 17. The Use Case: PBS TeacherLine Peer Connection Two examples of how discussions appear in Peer Connection: /community/network/pbs-staff/group/tl-technology/discuss/ /content/module/216/discuss/
  • 18. The Use Case: PBS TeacherLine Peer Connection Content generated by the pluggable app: /content/module/216/discuss/ /community/network/pbs-staff/group/tl-technology/discuss/
  • 19. The Use Case: PBS TeacherLine Peer Connection Content required by the presenting app templates: /content/module/216/discuss/ /community/network/pbs-staff/group/tl-technology/discuss/
  • 20. Make it So By making our discussions app pluggable, we solved our problems and fulfilled our requirements. But what kind of work does it take to get there?
  • 21. Make it So Parts of Pluggable Apps •  Pluggable URL definition •  Pluggable application views definition •  Subclass / instantiation of Pluggable application
  • 23. Pluggable Application Views Definition def
index(request): 



complaints
=
Complaint.objects.pluggable(request) 



form
=
ComplaintForm() 



template
=
request.pluggable.config.get('template’) 



base_template
=
request.pluggable.config.get('base_template’) 



return
render_to_response(template,
{ 







'complaints':
complaints, 







'form':
form, 







'base_template':
base_template, 







},
context_instance=RequestContext(request))
  • 24. Subclass / Instantiation of Pluggable Application class
SillyWalkComplaintsApp(ComplaintsApp): 



def
pluggable_config(self,
request,
walk_slug=None): 







return
{'base_template':
'sillywalks/view.html'} 



def
pluggable_view_context(self,
request,
walk_slug): 







try: 











sillywalk
=
SillyWalk.objects.get(slug=walk_slug) 







except
SillyWalk.DoesNotExist: 











raise
Http404 







return
sillywalk 



def
pluggable_template_context(self,
request,
walk_slug): 







return
{'sillywalk':
request.pluggable.view_context} complaints_app
=
SillyWalkComplaintsApp('sillywalks')
  • 25. And Now For Something Completely Different Let’s see some live examples…
  • 26. Thank You For Your Time Code referenced in this presentation is available at: http://bit.ly/django-pluggables Nowell Strite Twitter: @nowells Email: nowell@strite.org Shawn Rider Twitter: @shawnr Email: shawn@shawnrider.com

Editor's Notes

  1. Welcome and introductions Today we want to present to you a design pattern that has been useful to us at PBS. This pattern allows applications to be presented by other objects or applications and at multiple contextualized URLs.
  2. PBS manages a lot of websites Some of these are created internally by PBS project teams Of the sites created internally many contain some significant Django component (switch to next slide as you’re saying this)
  3. This is not to say that all of these sites are solely powered by Django, but all of these sites rely on Django-based components. And some of them are completely powered by Django.
  4. PBS also hosts sites for independent producers, such as ken burns or weta or itvs Of these sites, some also use Django. (proceed as saying this)
  5. Again, not all of these sites use Django exclusively, but they use Django to varying degrees, mostly to supply specialty content and functionality.
  6. Since 2006, PBS has been using Django Django helps us solve problems in a variety of ways For all the reasons listed here, Django is a useful framework for us PBS was initially built largely on Perl scripts outputting static HTML But there was also some mix-in of Java and earlier Python frameworks such as Zope/Plone As we move forward, we must be able to support existing functionality while we build new functionality Django is flexible enough to allow us to do this Django has also allowed us to begin building components that can be leveraged by stations and producers building their own Django sites
  7. (N) Historically, reusable apps have been very helpful for spreading around similar functionality across different websites and projects.
  8. Reusable apps have a few limitations: They are designed to live at a single URL location To supply extra context info one must overload the URLconf, which gets messy quickly To have a reusable app appear to be styled like a different part of the site can require many different templates.
  9. Template Tags are often used to combine functionality from different apps into single pages.
  10. Template Tags are also very useful, but have some drawbacks: Form posts and handling errors in form posts are especially problematic. The user experience of submitting a post and being taken to a standalone error resolution or preview page is unacceptable. Context data can be added and manipulated with Template tags, but only if the tag has been written that way (many reusable apps template tags do not have the ability to accept arbitrary context data – and why should they?) Additional logic can be difficult to enforce or bypass
  11. (S) It’s helpful to look at a real-world example. In this case, we will examine a use case we were confronted with during the development of our social networking tool for educators’ professional development, PBS TeacherLine Peer Connection. Peer Connection is a social site that helps educators fulfill professional development requirements. It provides two major features: Access to curated content and community features. The site is designed to support real-world instructional coaching and mentoring programs in place at many schools, and it is intended to both help teachers become more comfortable with modern networked technologies as well as helping them develop their teaching practice.
  12. So as we set out to add a discussions feature to almost every object in the site (Networks, Groups, Learning Modules, Resources), we needed to adhere to a set of requirements. These were essential requirements, not all of which can be fulfilled with the traditional approaches.
  13. By making an app “pluggable” we gain extra features:
  14. These are two examples of how discussions appear in Peer Connection. One discussion area is attached to a Group, which is a subset of a Network. The other discussion area is attached to a Professional Development Module, which is a piece of curated content from the PBS team. It is essential that these discussions display under the URL hierarchy set up for displaying Networks, Groups, instructional Modules, etc.
  15. As you can see, the presentation of the pluggable discussion app’s functionality on these pages is surrounded by differentiated navigation that fits with the presenting application. So in this example, you can see that Discussions are a first-class link under the left sidebar navigation of your Group listing.
  16. However, when presented as a part of an instructional Module, the discussion area is accessed through a sub-navigation that is not part of the first-class navigation structure for the instructional Module.
  17. This content is generated by the pluggable app. The pluggable app knows nothing about the presenting application And the presenting app knows nothing about the pluggable application or its required context.
  18. (N)
  19. This is the URL conf Similar to traditional, but embedded in an class that inherits form PluggableApp This definition is only required once – any other app or object in my site project could present this application using this URL configuration
  20. By default any common Django design approach will work fwith the Pluggables pattern. However, pluggable applications also support class-based views, which might provide even more flexibility to your project.
  21. For each app that presents a pluggable application, there are three points at which you may customize behavior. If customization is required, you must create one of these classes for every application that will present a pluggable application. In this example we are looking at the configuration for presenting the Complaints app within the Silly Walks application. The pluggable_config defines a dictionary of configuration parameters that can be customized. The pluggable_view_context supplies any expected objects that the pluggable application needs to work. In this case, the pluggable application requires an object to attach complaints to, and we are giving it a SillyWalk to use for that object, anchoring your complaint to this object. This is a common use case, but certainly not required by every pluggable application. Finally, the pluggable_template_context determines which data should be passed through to the template itself. This may be required for rendering various aspects of the template that are dependent on the presenting application.
  22. Follow PEP8 with our examples