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

How to combine JavaScript & Django in a smart w...

How to combine JavaScript & Django in a smart way - DjangoCon Europe 2013

Have you been using JavaScript more and more when building your web applications? Are you implementing REST API frequently? If so, you have probably realised that server-side generated content is no longer enough to provide cutting edge user experience.

I would like to show you how to avoid jQuery callback hell and how to gain more flexibility using MVC on the client side. I will introduce tools for managing modules in JavaScript and will teach you how to become more productive with CoffeeScript. I will share my experience of integrating Django and sophisticated JavaScript stack from two points of view: RESTful API and static files management. Let the trip begin!

Avatar for Przemek Lewandowski

Przemek Lewandowski

May 15, 2013
Tweet

More Decks by Przemek Lewandowski

Other Decks in Programming

Transcript

  1. About me • PyWaw co-organiser • co-founder at SUNSCRAPERS, software

    house based in Warsaw • technology enthusiast • sports lover
  2. • illegible code • distributed logic • callback hell Possible

    problems • decreasing productivity • code is not testable
  3. Advanced approach • communication with server ◦ REST API, Websockets

    • application building ◦ combining and minimizing files • static files management ◦ handling static files servers and caches • JavaScript improvements ◦ frameworks, AMD, CoffeeScript
  4. Let's get a tour in the Django World! How do

    we roll things at SUNSCRAPERS?
  5. Define requirements • powerful JS framework • CoffeeScript • testable

    code • JS code minimization • avoiding caches by fingerprints • rapid REST API development
  6. Why CoffeeScript? • adds "syntactic sugar" • helps to write

    less code faster • performs as well as JavaScript • avoids some JavaScript traps like "=="
  7. Why not Backbone? • lack of bindings mechanism • there

    are no reusable views • models are poor
  8. Stack summary • Angular or Ember • RequireJS • django-require

    • django-rest-framework • django-storages