Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Make your Pony fly with Google App Engine

Make your Pony fly with Google App Engine

Why and how could be useful developing web services with Django and deploying them on Google App Engine

Aee59cb61d6561244163f490aec50939?s=128

Massimiliano Pippi

November 16, 2013
Tweet

More Decks by Massimiliano Pippi

Other Decks in Programming

Transcript

  1. 16.Nov.2013 DevFest @ Rome Google Developer Group http://gdg-perugia.org

  2. Massimiliano Pippi Software Developer, Python Lover, Dad. @maxpippi http://github.com/masci http://dev.pippi.im

    Who are you?
  3. Make your pony fly with Google App Engine

  4. A pythonista in the lands of Java

  5. • easy to learn, simple to use • clean syntax

    • huge range of libraries • rapid prototyping • vast documentation • friendly community • named after Monty Python Why Python?
  6. • easy to learn, simple to use • automatic scaling

    • deploy and forget Why App Engine?
  7. Why Django? • easy to learn, simple to use •

    full stack • modular (almost) • named after Django Reinhardt
  8. What can a pony do for you? Some sweeties for

    mobile developers • data backends exposing REST api • backoffice systems and CRUDs • servers talking to cloud messaging services
  9. The pony into the wild Build a REST web service

    in minutes • design the business model • provide a REST api • authenticate users with the OAuth2 framework
  10. Toodo app Track a list of tasks with a description

    and a flag to mark them as done The Model
  11. Django Restframework (third party application providing some magic) The API

  12. The API URL style HTTP Method Action URL Name /

    GET show API infos api-root /tasks/[.format] GET list tasks tasks-list POST create a new task /tasks/{id}/[.format] GET retrieve task tasks-detail PUT update task PATCH partially update task DELETE destroy task Data serialized in dozen of formats out of the box: JSON, JSONP, XML, Yaml and others, plus you can write your very own. Bonus: api browser
  13. Interact with the API through html pages and form (it’s

    free) The API browser
  14. The API browser

  15. The API browser

  16. Django OAuth Toolkit (third party application providing oauth goodies) Let’s

    do OAuth2 (seriously, that’s all folks!) Now the system acts as an OAuth2 provider and the api endpoints grant access to clients providing valid tokens
  17. Hooray, we found the Grail!

  18. Well, not quite. There are a lot of pros running

    Django on App Engine • one-click deploy, app versioning • scale as you want • Google infrastructure But some of the cons could be blocking • Google Cloud SQL is the only backend supported by the Django ORM • Google Cloud SQL has no free tiers (at the moment) • Google Cloud SQL is MySql
  19. Thanks for your attention! Questions? (in the meantime, take a

    look at the code) https://github.com/masci/toodo http://django-rest-framework.org https://github.com/evonove/django-oauth-toolkit Massimiliano Pippi @maxpippi http://github.com/masci http://dev.pippi.im