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

Djangocong Apps to Services

Djangocong Apps to Services

Craig Kerstiens

April 14, 2012
Tweet

More Decks by Craig Kerstiens

Other Decks in Programming

Transcript

  1. Django Apps to Services

    View Slide

  2. Craig Kerstiens
    @craigkerstiens work at @heroku

    View Slide

  3. Project
    App
    A collection of configuration and apps for a
    particular Website.
    (per Django Project)
    Django

    View Slide

  4. Project
    App
    A collection of configuration and apps for a
    particular Website.
    A web application that does something. I.e.
    Weblog, Poll, Ticket system
    (per Django Project)
    Django

    View Slide

  5. Within Django

    View Slide

  6. Project
    Within Django

    View Slide

  7. Project
    App
    Within Django

    View Slide

  8. Project
    App
    App
    Within Django

    View Slide

  9. Project
    App
    App
    App
    Within Django

    View Slide

  10. Project
    App
    App
    App
    Tickets
    FAQ
    FaqCreator
    Within Django

    View Slide

  11. REUSABILITY means faster features
    due to DRY (Don’t Repeat Yourself)
    REUSABILITY does not always mean
    SCALABILITY or MAINTAINABILITY

    View Slide

  12. Project
    App
    A collection of configuration and apps for a
    particular Website.
    A web application that does something. I.e.
    Weblog, Poll, Ticket system
    (per Django Project)
    Django

    View Slide

  13. Project
    App
    A collection of configuration and apps for a
    particular Website.
    A web application that does something. I.e.
    Weblog, Poll, Ticket system
    Django
    Service Method of communication over the web.
    Web APIs allow combination of multiple services

    View Slide

  14. View Slide

  15. Tech imitate Teams
    Project
    App
    App
    App
    Tickets
    FAQ
    FaqCreator
    Company
    Support
    Knowledge Base

    View Slide

  16. App
    App
    Support
    Knowledge
    Base
    Teams Grow

    View Slide

  17. App
    App
    Support
    Knowledge
    Base
    Billing
    Teams Grow

    View Slide

  18. App
    App
    Support
    Knowledge
    Base
    Billing
    Marketing
    Teams Grow

    View Slide

  19. App
    App
    Support
    Knowledge
    Base
    Billing
    Marketing
    Analytics
    Mobile
    API
    Front End
    Social
    Teams Grow

    View Slide

  20. App
    App
    App
    Support
    Knowledge
    Base
    Billing
    Apps Grow
    Marketing
    Analytics
    Mobile
    API
    Front End
    Social
    3 Apps

    View Slide

  21. App
    App
    App
    Support
    Knowledge
    Base
    Billing
    Apps Grow
    App
    App
    App
    Marketing
    Analytics
    Mobile
    App
    App
    App
    API
    Front End
    Social
    9 Apps

    View Slide

  22. Support
    Knowledge
    Base
    Billing
    Apps Grow
    Marketing
    Analytics
    Mobile
    API
    Front End
    Social
    9 Apps
    1 Codebase

    View Slide

  23. Defined contract for communicating
    Service

    View Slide

  24. Defined contract for communicating
    Service
    $ curl -O $FAQ_API/create/ -X “question=my\ question
    source=123”

    View Slide

  25. In Python

    View Slide

  26. In Python
    data = {
    ‘question’: “my question”,
    ‘source’: 123
    }
    requests.POST(os.environ[‘FAQ_API’] + ‘/create/’, data=data)

    View Slide

  27. View Slide

  28. Version Bump
    data = {
    ‘question’: “my question”,
    ‘source’: 123,
    ‘related’: [456, 789]
    }
    requests.POST(os.environ[‘FAQ_API’] + ‘/v2/create’, data=data)

    View Slide

  29. Version Bump
    data = {
    ‘question’: “my question”,
    ‘source’: 123,
    ‘related’: [456, 789]
    }
    requests.POST(os.environ[‘FAQ_API’] + ‘/v2/create’, data=data)

    View Slide

  30. Version Bump

    View Slide

  31. Version Bump
    data = {
    ‘question’: “my question”,
    ‘source’: 123,
    ‘related’: [456, 789]
    }
    requests.POST(os.environ[‘FAQ_API’] + ‘/v2/create’, data=data)
    STILL VALID
    requests.POST(os.environ[‘FAQ_API’] + ‘/v1/create’, data=data)

    View Slide

  32. Whats a service
    Provider API_HOST= http://127.0.0.1

    View Slide

  33. Whats a service
    Provider
    Endpoint
    API_HOST= http://127.0.0.1
    /v1/create/

    View Slide

  34. Whats a service
    Provider
    Endpoint
    API_HOST= http://127.0.0.1
    /v1/create/
    Contract {
    ‘question’: ‘foo bar’,
    ‘source’: 123
    }

    View Slide

  35. Service
    App

    View Slide

  36. Service
    App
    Models
    Views
    URLs
    Provider Endpoint Contract

    View Slide

  37. A SERVICE means
    REUSABILITY and
    enables SCALABILITY
    and MAINTAINABILITY

    View Slide

  38. A SERVICE means
    REUSABILITY and
    enables SCALABILITY
    and MAINTAINABILITY

    View Slide

  39. Fin.
    Resources
    http://bit.ly/djangocong
    http://bit.ly/appstoservices
    http://www.12factor.net

    View Slide