Using Node.js with Django and Backbone.js Using Node.js with Django and Backbone.js django django

Using Node.js with Django and Backbone.js


It sounds like your application does not necessarily need Node.js. The main reasons you might want to use Node in addition to a more traditional framework like Django or Rails is if there is a real time or multiplayer aspect to your application.

I wouldn't use Node.js because there is a lot of fuss about it - if you need the aforementioned functionality, though, it can be great.

A high level architecture of your application might look something like:

Django

  • Serving your single page
  • Serving assets(css, js, images, etc...)
  • Handling DB connection - best to setup RESTful routes for each data model
  • Data processing, etc...

Backbone

  • Handling user interaction
  • Make http requests to read and write data

Node (Optional)

  • Use something like Socket.io to notify clients of updates (instead of poling)
  • You can replace the functionality of Django with one or a combination of node modules


If you feel comfortable with python and Django in general, I'd recommend using a web server like Tornado. It is very easy to use and has a steep learning curve if you're familiar with Django. In general, you'll see performance improvements and you'll have the ability to implement otherwise "obscure" functionality, like Comet programming.

As for the frontend, yes, Backbone is an excellent choice, but keep an eye on Coffeescript too...