Django Vs Rails

Diez B. Roggisch deets at nospam.web.de
Tue Sep 6 05:08:37 EDT 2005


gene tani wrote:
> http://griddlenoise.blogspot.com/2005/07/python-off-rails.html

I don't think that opinion is very founded - especially what he thinks 
metaprogramming is about, and what not.

What he seems not to grasp is the crucial difference between django and 
rails/subway (at least in the way the yare _used_ by his examples):

  - rails/subway reflect over a existing table. They create OR-mappings 
based on that. You only specify exceptional attributes for these mappings.

  - django specifies the whole meta-model in python - and _generates_ 
the SQL/DDL to populate the DB. So obviously you have to be more verbose 
- otherwiese you won't have the fields you need.


I personally prefer the latter approach - I want my tables modeled after 
my objects, not the other way round. I tried to find out if subway and 
rails can do the same - that is, generate the sql. For subway the lack 
of documentation prevented that, and I didn't find it in rails , too.

And there is at least one shortcoming to the first approach, when using 
the most popular RDBMS, MySQL: The lack of foreign key constraints makes 
me wonder how to automatically infer 1:n or m:n relationships. From a 
rails tutorial, I see that one has to declare these too:

http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html?page=5


But maybe someone who has expirience with subway or rails can elaborate 
on this?

Diez



More information about the Python-list mailing list