Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Using Node.js with Django and Backbone.js

Using Node.js with Django and Backbone.js

Problem

Some background: I am planning to build an Application with Django as backend and using Backbone.js as the frontend Javascript framework. It is a Single page application (SPA) and this is the reason I decided to use Backbone.js. The application is similar to a blogging engine; users post entries containing text and images and are able to view them by "tag". They can search through their entries by "tag" or by a particular word.

Lately after hearing about all the fuss about Node.js, I am wondering how can it help my application? But I don't want to make the app run purely on node.js on the backend, i.e I still wish to use Django for the backend. Would it be possible to use Node for the "middle end" as mentioned here?

How can I optimise my app with Node.js?

Problem courtesy of: user926432

Solution

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
Solution courtesy of: cmpolis

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Using Node.js with Django and Backbone.js

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×