What advantage of backbone js be using with django
My question is pretty simple: Currently the stack i use is django+coffeescript.
Is coupling django, backbone js a good idea? What advantage does it offer? Could anyone take me through the pros and cons.
PS: I know backbone js being an MVC.
Well, the resources are best answered at two different places, I do not wish to repeat them here:
- How does Backbone.js interact with Django?
- What are the advantages of Backbone.js?
- What are some good resources for Backbone.js?
Backbone.js offers an MVC way of doing things on the client-side. You can of course mix coffeescript with backbone quite easily.
If your app has to perform quite a lot of stuff on the client-side, adopting backbone is going to let you achieve this in a cleaner, more structured and elegant way.
We use backbone+django extensively for an app, however, django alone doesn't really mix well with backbone, as most of the template system and some of the view system become superfluous when you communicate over a REST-api. Luckily you can easily add an API to django through piston, tastypie or our favorite django-rest-framework.
A problem is the doubled code-base, you need to define models and potentially form validation logic twice, in different frameworks. You might want to look at node.js as a replacement for django on the backend to be able to reuse logic on both sides of the http. Perhaps take a look at capsule from andyet.com (Henrik Joreteg to be precise) for reusing backbone logic across client and server.
A new kid on the block seems to be djangbone (https://github.com/af/djangbone) makes it really easy to use the Django ORM with backbone!