Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using backbone/ember makes django being a simple REST API?

I have read a couple of articles about using new JS frameworks like Backbone.js or Ember.js

I have come up to this statement: If I use a JS framework like Backbone.js/Ember.js, I then move the logic from the back-end (Django) to the front-end.

Therefore, will Django actually be used only for its Models? Does that mean that Django Views and Django Template are not needed anymore and the Django back-end is kinda turn into a "basic" REST API that will be consumed by the front end.

Do you agree? Is it then the purpose of Django in this case?

Is turning the django backend into a REST API one of the most suitable use case when using a framework like Backbone.js/Ember.js for the front-end?

Thanks.

like image 964
Michael Avatar asked Aug 01 '12 16:08

Michael


2 Answers

Django is perfectly fine to be used this way, you still get the admin, the models, the orm and all the third-party plugins. However, it isn't blazingly fast, so if you're doing simple document level, non-relational REST mapping, you might wan't to look into node.js and mongoDB for instance.

If you're sticking with django (like we are, we like the structure it gives us), you can use one of the REST plugins:

  • Django Rest Framework A perfect match since DRF 2.0, under very active development!
  • Django Tastypie (checkout backbone-tastypie.js for integration)
  • Django Piston (might be a bit stale or has development picked up lately?)

If you only want to work with frontend development, checkout the Backend-as-a-Service places like cloudmine.me or firebase.com that handle all backend stuff for you, for a price of course.

like image 75
Jens Alm Avatar answered Oct 19 '22 06:10

Jens Alm


Django may seem unnecessary once you start thinking about single page solutions and Javascript applications, but if you want your site to be 'fail proof' it wouldn't be impossible to develop both a client side Javascript version of the site as well as a backend django side incase the user, or your site's javascript, fails at some level. Of course this requires creating your site twice, and probably isn't needed in the age of modern browsers, but such would be one of the few instances where you would mix the two for a complete solution.

like image 33
Stieffers Avatar answered Oct 19 '22 05:10

Stieffers