Ruby on Rails v/s Django
Ruby on Rails
- Web Development that doesn't hurt
- Open-source webdevelopment framework that's optimised for programmer's happiness and sustainable productivity.
- Lets you write beautiful code by favoring convention over configuration.
Django
- The Web framework for perfectionists (with deadlines).
- Django makes it easier to build better Web apps more quickly and with less code.
- Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Ruby on Rails vs Django
Category | Ruby on Rails | Django |
---|---|---|
Architecture | MVC : Model - Controller - View | MTV : Model - Template - View |
Object Relational Mapping - ORM |
Active Records | Django Model Instance Reference |
Bundled JavaScript | Comes with bundled copies of: Prototype.js script.aculo.us JavaScriptHelper part of the framework. |
Ships JQuery as a part of the Admin Interface. Not a part of the framework. |
Views/Templates | Rails Rendering/Layout | Django Templating |
Directory Structure | $ rails newrails | $ django-admin startproject newdjango $ cd newdjango $ python manage.py startapp myapp |
Authentication Modules | No built-in authentication framework. Third party authentication plugins available: Restful Authentication. Authlogic |
Authentication part of the framework. |
Learning curve | Steep Learning Curve Lots of framework specific stuff to learn Django |
Slight learning curve if you are already familier with Python. The Django template language |
Database Schema Management | $ rake db:migrate | $ python manage.py syncdb |
REST - Representational State Transfer
- Using resource identiers (URLs) to represent resources
- Transferring representations of the state of that resource
- between system components.
Example
- To a Rails application a request such as:
- DELETE /photos/17
- would be understood to refer to a photo resource with the ID of
- 17, and to indicate a desired action | deleting that resource.
- REST is a natural style for the architecture of web applications,
- and Rails makes it even more natural by using conventions to shield
- you from some of the RESTful complexities and browser quirks.
Migrations
Definition
- Migrations are a convenient way for you to alter your database in a structured and organised manner.
- You could edit fragments of SQL by hand but you would then be responsible for telling other developers that they need to go and run it.
- You'd also have to keep track of which changes need to be run against the production machines next time you deploy.
- Migrations are a convenient way for you to alter your database in a structured and organised manner.
- You could edit fragments of SQL by hand but you would then be responsible for telling other developers that they need to go and run it.
- You'd also have to keep track of which changes need to be run against the production machines next time you deploy.
Proof.
- This file is auto-generated from the current state of the
- database. Instead of editing this file,
- please use the migrations feature of Active Record to
- incrementally modify your database, and
- Then regenerate this schema definition.
Rails Scaffold
- Scaffolds an entire resource, from model and migration to controller and views, along with a full test suite. The resource is ready to use as a starting point for your RESTful, resource-oriented application.