Motion Django Meetup

Software Developer at Six Apart
Oct. 22, 2009
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
Motion Django Meetup
1 of 50

More Related Content

What's hot

Using Sinatra to Build REST APIs in RubyUsing Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in RubyLaunchAny
Building Better Web APIs with RailsBuilding Better Web APIs with Rails
Building Better Web APIs with RailsAll Things Open
Refactor Dance - Puppet Labs 'Best Practices'Refactor Dance - Puppet Labs 'Best Practices'
Refactor Dance - Puppet Labs 'Best Practices'Gary Larizza
Building Beautiful REST APIs in ASP.NET CoreBuilding Beautiful REST APIs in ASP.NET Core
Building Beautiful REST APIs in ASP.NET CoreNate Barbettini
Building Beautiful REST APIs with ASP.NET CoreBuilding Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreStormpath
Pourquoi ruby et rails déchirentPourquoi ruby et rails déchirent
Pourquoi ruby et rails déchirentNicolas Ledez

Viewers also liked

Marketing DigitalMarketing Digital
Marketing DigitalFélix J. Merán Montenegro-Oratoria y Marketing Digital
¿Qué es la Facioterapia?¿Qué es la Facioterapia?
¿Qué es la Facioterapia?UIMEC cursos de acupuntura
2911 1 32911 1 3
2911 1 3Boopathi Yoganathan
Manual magento 1-1Manual magento 1-1
Manual magento 1-1plopez_7
Norwich o crest_bredNorwich o crest_bred
Norwich o crest_bredcriaderodecanarios
Digital Influence - The social professionalDigital Influence - The social professional
Digital Influence - The social professionalDallas McMillan

Similar to Motion Django Meetup

Bpstudy20101221Bpstudy20101221
Bpstudy20101221SATOSHI TAGOMORI
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformAntonio Peric-Mazar
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileIVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileAmazon Web Services Japan
ApiApi
Apirandyhoyt
Designing and Implementing a Multiuser Apps PlatformDesigning and Implementing a Multiuser Apps Platform
Designing and Implementing a Multiuser Apps PlatformApigee | Google Cloud
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformAntonio Peric-Mazar

Recently uploaded

How to use the Cataloguing Code Ethics at your day job : a hands-on workshop ...How to use the Cataloguing Code Ethics at your day job : a hands-on workshop ...
How to use the Cataloguing Code Ethics at your day job : a hands-on workshop ...CILIP MDG
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Maxim Salnikov
Machine learning with quantum computersMachine learning with quantum computers
Machine learning with quantum computersSpeck&Tech
The Ultimate Administrator’s Guide to HCL Nomad WebThe Ultimate Administrator’s Guide to HCL Nomad Web
The Ultimate Administrator’s Guide to HCL Nomad Webpanagenda
Netwitness RT - Don’t scratch that patch.pptxNetwitness RT - Don’t scratch that patch.pptx
Netwitness RT - Don’t scratch that patch.pptxStefano Maccaglia
GDSC Cloud Lead Presentation.pptxGDSC Cloud Lead Presentation.pptx
GDSC Cloud Lead Presentation.pptxAbhinavNautiyal8

Motion Django Meetup

Editor's Notes

  1. - The bottom layer is remoteobjects & batchhttp, we’ll talk about those later. - The Python TypePad API library is a pure Python client library for talking to the TypePad API - typepadapp is a Django application that provides basic functionality that’s generally useful for Django apps built on top of TypePad like user authentication, OAuth token management, session management, and session synchronization - typepad-motion is really just a thin layer on top of these building blocks - it’s a set of views, URLConfs, templates, and some static resources like CSS, images, and javascript
  2. So, to simplify things to a stupid degree, the Motion architecture looks something like this.
  3. PyPi, pip, distribute, setuptools, etc. help a lot. We could decompose Motion into separate apps and maintain a good design, but still make it really easy to install. It also let us leverage outside code like httplib2 without having to include all of that stuff in our distributions. We’re using a custom management command to install our own skeleton files for a typepad project. You don’t have to use it, but it will set up sane defaults for all the Motion settings. Obscure settings are in motion.settings, so our default settings.py imports * from there.
  4. Turns out Django’s Management commands in Django really easily. Django iterates over your installed apps and looks in management/commands/<commandname>.py for a class called Command that subclasses management.base.BaseCommand. So once you have a project it’s easy to add commands. It’s a bit trickier for django-admin.py because you don’t have any installed apps by default. But you can specify a settings file to django-admin.py and it’ll load those settings before it tries to find the command. Score!
  5. Automatically creates directory structure for theming & static resources, creates urlpattern for static media. Stupid Django 1.1.1 “security patch” broke this stuff though, fixed in Motion trunk, but not in the PyPi version.
  6. All of our templates just extend motion/base/<template>.html. Thus, you can create a template _with the same name_, also extend motion/base/<template>.html, and override specific blocks. This is basically an alternative to letting you create templates that have different names and then pass them in as kwargs in your urls.py.
  7. We decomposed our templates a lot to make them more extensible. Problem is, whenever a template is rendered Django has to read it from disk, lex it, parse it, and then render it. It doesn’t do any caching. This was taking around 1ms per template. We were rendering hundreds of templates. It adds up.
  8. All Django requires for a “view” function is a “callable” that returns an HttpResponse. You can use a function to do this, but you can also use classes. We decided to use classes so we could provide hooks that make it easier to extend Motion - like batch HTTP stuff.
  9. Here’s an example of a RemoteObject class representing a Twitter user. The code for this comes with the remoteobjects package, by the way. There are a number of other examples that come with the package as well.
  10. - For context I’ll just summarize the resource model for the TypePad API
  11. Data API URLs always start with a noun and an id A bare URL like this retrieves a single object
  12. A third path level selects a sub-resource of a top-level object Many of these are lists
  13. List resources tend to support filters which constrain what items are returned. There are both parameterized filters...
  14. ...and boolean filters. and in some cases multiple filters can be combined together.
  15. Every page in Motion is constructed predominently from data retrieved from TypePad via the API.
  16. We need to get all of the required data out of TypePad as quickly as possible.
  17. At first, we just used parallel HTTP requests, which is pretty straightforward. This proved inefficient within TypePad’s infrastructure since we ended up with each request in its own Apache process. While other architectures are possible, completely reinventing our stack would be time-consuming.
  18. We briefly considered HTTP Pipelining as a purist solution, but in practice we found various problems. - Poor client library support - Poor infrastructure support (our load balancers don’t support pipelining) - Implementation would’ve been complicated due to having to maintain the request order.
  19. We eventually settled on having a special endpoint for submitting batch requests.
  20. The client submits a single request to the batch processor which contains a description of all of the constituent requests. The individual requests get handled, and are returned together as a single HTTP response. But we need to figure out what a description of a batch job looks like on the wire...
  21. We looked at some prior art here, but everything seemed to be specific to the API it was wrapping. Figuring that batch processing ought to be transparent, we wanted something that could exist as a separate infrastructure layer.
  22. Think of it as an HTTP proxy with a funny-looking frontend. We use a multipart MIME message with each part containing a HTTP message as our wire format. This allows HTTP messages to be wrapped with minimal overhead.
  23. Although our internal implementation actually does something more clever, the protocol presents the illusion that each request is being handled independently as if it were a proxied request to a data endpoint.
  24. We think this approach ought to work for other REST-based APIs, so we made a point of keeping it generic and we’ve released a draft specification and some sample implementations, including a Python client library which works with httplib2 and a Twisted-based proxy that can be used to put a batch processor frontend in front of some existing endpoints.