Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Django Vs Rails

79 views
Skip to first unread message

flamesrock

unread,
Sep 5, 2005, 10:06:51 PM9/5/05
to
Firstly, this topic is NOT intended for trolling or starting any flame
wars.

I want to know if anyone has experience with these frameworks, and if
so, how do they compare? Which one do you prefer?

Going back to school in a few days, I simply don't have the time to try
both.

-thanks
http://djangoproject.com
http://rubyonrails.com

D H

unread,
Sep 5, 2005, 10:48:33 PM9/5/05
to
flamesrock wrote:
> Firstly, this topic is NOT intended for trolling or starting any flame
> wars.

Whatever you say, "flamesrock".

gene tani

unread,
Sep 5, 2005, 10:56:36 PM9/5/05
to

flamesrock

unread,
Sep 5, 2005, 11:02:55 PM9/5/05
to
Thanks for the links, gene tani.

D H,
'flamesrock' refers to the Calgary Flames, not the act of flaming.

Diez B. Roggisch

unread,
Sep 6, 2005, 5:08:37 AM9/6/05
to
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

gene tani

unread,
Sep 6, 2005, 7:32:34 AM9/6/05
to
Here's another, (i'm just flipping thru del.icio.us and furl tags, not
endorsing any viewpoints. I've never looked at Django or Subway, but I
do need to look at zope 3, i think):

http://www.magpiebrain.com/archives/2005/08/14/rails_and_django

Jaroslaw Zabiello

unread,
Sep 6, 2005, 8:47:02 AM9/6/05
to
Dnia 5 Sep 2005 19:06:51 -0700, flamesrock napisał(a):

> Firstly, this topic is NOT intended for trolling or starting any flame
> wars.
>
> I want to know if anyone has experience with these frameworks, and if
> so, how do they compare? Which one do you prefer?

Django's ORM does not work with SQL Server (only Postgresql, MySQL and
SQlite). it would be problem to use Django for m$ based intranets. Rails
has more features, better docs and seems to be more mature than Django. And
last but not least, Django has no official release up today.

--
JZ

D H

unread,
Sep 6, 2005, 12:15:28 PM9/6/05
to
flamesrock wrote:
> D H,
> 'flamesrock' refers to the Calgary Flames, not the act of flaming.
>

It was just a joke about your statement and your name. I thought it was
obvious enough that a smiley wasn't necessary. I don't care though,
flames happen on comp.lang.python all the time.
Go with Rails. Django is only like a month old. Unless you are more
comfortable using python than ruby.

bruno modulix

unread,
Sep 6, 2005, 12:56:14 PM9/6/05
to
D H wrote:

(snip)


> Go with Rails. Django is only like a month old.

Please take time to read the project's page. Django has in fact three
years of existence and is already used on production websites, so it's
far from pre-alpha/planning stage.

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'on...@xiludom.gro'.split('@')])"

Alan Kennedy

unread,
Sep 6, 2005, 1:08:04 PM9/6/05
to
[D H]

>>Go with Rails. Django is only like a month old.

[bruno modulix]


> Please take time to read the project's page. Django has in fact three
> years of existence and is already used on production websites, so it's
> far from pre-alpha/planning stage.

But the APIs still aren't 100% stable.

http://www.djangoproject.com/screencasts/model_syntax_change/

--
alan kennedy
------------------------------------------------------
email alan: http://xhaus.com/contact/alan

D H

unread,
Sep 6, 2005, 1:07:16 PM9/6/05
to
bruno modulix wrote:
> D H wrote:
>
> (snip)
>
>>Go with Rails. Django is only like a month old.
>
>
> Please take time to read the project's page. Django has in fact three
> years of existence and is already used on production websites, so it's
> far from pre-alpha/planning stage.
>

Don't make any assumptions about what I have and haven't read. Django
was only publicly released in mid-July. Less than two months ago.
I never implied it was "pre-alpha" or in a "planning" stage.
The Ruby framework is also more mature and much much more tested than
Django. But even then I am not stating one is inherently better than
the other. Both seem very well designed. But if you have no clue about
either project like the original poster, then I'd recommend Rails,
unless you are already comfortable with Python (and not used to Ruby),
which case go with Django.

bruno modulix

unread,
Sep 6, 2005, 1:31:06 PM9/6/05
to
D H wrote:
> bruno modulix wrote:
>
>> D H wrote:
>>
>> (snip)
>>
>>> Go with Rails. Django is only like a month old.
>>
>>
>> Please take time to read the project's page. Django has in fact three
>> years of existence and is already used on production websites, so it's
>> far from pre-alpha/planning stage.
>>
>
> Don't make any assumptions about what I have and haven't read.

Don't make the assumption that the advice to read the project's page was
directed to you only !-)

> Django
> was only publicly released in mid-July. Less than two months ago.
> I never implied it was "pre-alpha" or in a "planning" stage.

That what I understood from your post, and I guess most readers would
understand it that way.

Now the fact that Django, while being young as a publicly realeased
project, has in fact 3 years of existence *on production websites* is
IMHO worth mentioning, so peoples who haven't read the project's page
yet don't make the assumption that it must be too young to be usable in
production. The "take time to read..." advice was directed to these
people as well !-)

Regards
--
bruno desthuilliers
ruby -e "print 'on...@xiludom.gro'.split('@').collect{|p|
p.split('.').collect{|w| w.reverse}.join('.')}.join('@')"

gene tani

unread,
Sep 6, 2005, 1:38:32 PM9/6/05
to
just to make it really easy, there's some really good blogs and
detailed analyses of the frameworks, competition is good:

http://del.icio.us/tag/rails+django

Terry Reedy

unread,
Sep 6, 2005, 4:19:51 PM9/6/05
to pytho...@python.org

"bruno modulix" <on...@xiludom.gro> wrote in message
news:431dca31$0$29335$636a...@news.free.fr...

>D H wrote:
>
> (snip)
>> Go with Rails. Django is only like a month old.
>
> Please take time to read the project's page. Django has in fact three
> years of existence and is already used on production websites, so it's
> far from pre-alpha/planning stage.

One can also check it out in action.
http://www.ljworld.com/ is the site it was developed for.

Greg McIntyre

unread,
Sep 7, 2005, 8:01:39 PM9/7/05
to

Diez B. Roggisch wrote:
> 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.

In Rails you can do that with the command:

$ rake db_structure_dump

However I think it's not the prescribed way of using it because it
tends to involve losing all your data every time you make a schema
change. I think they recommend doing this once at the start of
development if you don't have a DB schema yet. Once you're up and
running, if you rely on ALTER TABLE type commands and manually update
your code to match the new schema, although it's more work it leaves
your data intact. I think that's the idea anyway.


> 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?

>From my experience with Rails, the OR mapping isn't hugely automated.
That is, some manual work is required if you change the schema, to
update the code that operates upon it. However although this is another
step it is pretty trivial due to the metaprogramming style methods.
Besides, if you're altering the schema you tend to have to update some
code anyway as you're most likely altering the functionality of the
system a little. And as I said above, a loose/manual OR mapping has its
benefits; I don't feel anxious about losing my data/schema when using
Rails because I know it leaves it alone.

flamesrock

unread,
Sep 7, 2005, 11:56:28 PM9/7/05
to
Wow- thanks for all of the replies. I'm torn.

On the one hand, I'm fluent in Python and love it.

On the other, Rails seems to have a brighter future, and is a bit more
featureful (at this time.) However the only Ruby I know is what I've
already learnt with Python(even though I would like to learn it).

How difficult would it be to learn Ruby+Rails, assuming that someone is
already skilled with Python?

Is it worth it?

James

unread,
Sep 8, 2005, 5:27:35 AM9/8/05
to
I actually like the framework to reflect on my database. I am more of a
visual person. I have tools for all my favorite databases that allow me
to get a glance of ER diagrams and I would rather develop my data
models in these tools rather than in code. Further more I rather like
the idea of parsimonious use of code (which is probably why I use
Python in the first place) and do not really like manually specifying
data schemas in code as much as possible.

Is some familiar with a Python Framework that builds by reflection.

Marek Kubica

unread,
Sep 8, 2005, 1:03:33 PM9/8/05
to
Hello!

On 7 Sep 2005 20:56:28 -0700 flamesrock wrote:

> On the other, Rails seems to have a brighter future,

Why that? Django is not yet released and everybody is talking about it.
Like it happened with RoR.

> How difficult would it be to learn Ruby+Rails, assuming that someone is
> already skilled with Python?

Learning Ruby: quite trivial, as Ruby is like Python, but sometimes there a
Ruby-way and a non-Ruby-way (codeblocks and stuff like this) and to write
nice Ruby programs you better write in the Ruby-way.

> Is it worth it?
Well, I've learned it, because it was easy but I haven't yet found a really
significant difference that makes Ruby much better than Python. You can
write some things in an very elegant way, but sometimes the Python solution
is more readable. But the docs are sometimes.. say: very compact ;).
As Ruby is not that hard to learn you could give it a try - maybe you'll
like it, maybe not.

RoR is not the only framework, some folks prefer Nitro.

greets,
Marek

Ian Bicking

unread,
Sep 14, 2005, 12:36:28 PM9/14/05
to
Diez B. Roggisch wrote:
> - 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.

Subway is built on SQLObject, and SQLObject can both create tables and
read schemas from an existing database. I don't know what style is
preferred at the moment in Subway, but personally I always create my
tables with SQLObject because I always end up enumerating all the
features of the tables eventually anyway.

Jeff Shell

unread,
Sep 14, 2005, 1:48:42 PM9/14/05
to
My opinion, as posted there, was pretty immediate and only going off of
surface values. I just saw in Django what I had seen too much of in my
own code. I've written similar things in Zope and Formulator that did
all sorts of fancy automatic 'admin screen' generation, DBMS CRUD
statements. I even applied those same tricks to LDAP with some success.
So some of what I saw with Django reminded me of code that I both loved
and hated - it made my data management work easy, but it was ugly and
hard to navigate and maintain, and I could never remember even my own
shortcuts and options of what to have in my nested dictionaries and
lists and tuples that defined all of these structures.

It was also an all-too-quick response in that I perceived, wrongly,
that Django was another Rails clone. I was quickly corrected on this,
and believe I posted a correction later. As I've said in some other
posts on my site - I don't really care much for the Python "Web
Frameworks" which go off and try to mimic the technology of the day.
I've been through competing with Perl, with Servlets, with J2EE, with
PHP/ASP, and now with Rails, and just about every implementation I've
seen of these has been underwhelming, to say the least. I myself am
guilty of writing an early WebObjects inspired toolkit back in '96.
Django is its own thing, and I give it credit for that. Some recent
changes to the Django model syntax make it more palatable to my tastes,
but I doubt that I'll personally be leaving Zope 2 or 3 for any of
these systems any time soon. Zope / Principia / Bobo have all served me
well for nearly a decade now, and Zope 3 makes ZODB based Zope
development so easy and powerful that I hope to never have need of an
ORM system again. These ORM tools like SQLObject and ActiveRecord still
seem best suited for writing applications from scratch. Ian Bicking and
Django people both have stated here that you can "conveniently generate
SQL/DDL to populate the DB". If that's the situation, an object
database like the ZODB or Durus may work just as well, without the
translation to SQL and back. ORM only gets interesting to me these days
when I have to map to to large scale pre-existing systems, and even
there I'm having better experiences with other styles of storage to
application data translation, validation, security, and management.

Jonathan Ellis

unread,
Sep 15, 2005, 12:35:57 PM9/15/05
to

PyDO (http://skunkweb.sourceforge.net/pydo2.html) is a Python ORM tool
that does this well (*cough* better than sqlobject *cough*).

-Jonathan

Jacob Smullyan

unread,
Sep 15, 2005, 1:56:22 PM9/15/05
to

As the current PyDO dev, I won't make the same comparative value
judgement as Jonathan here, not out of reticence, but lack of
conviction -- SQLObject is quite excellent, and for all I know better
than PyDO in execution -- but a comparison I would make is that PyDO
is different from ORMs like SQLObject (and even more so, from
ActiveRecord) in that it assumes that the database precedes the object
layer, chronologically and/or in significance, and that the database
schema shouldn't need to conform much to a particular ORM's
expectations, reasonable as they may or not be. The most obvious
differences are that SQLObject expects tables to have an "id" integer
column, and doesn't support multi-column candidate keys; PyDO doesn't
make such demands. So, similar as they are, in orientation these
libraries are somewhat different beasts.

I have mixed feelings about automagical schema introspection. PyDO
supports it, and will probably do so increasingly robustly if people
use it. But part of me feels that "explicit is better than implicit"
may win out over DRY here, because the ORM layer and the db layer
exist in different realms, and if the ORM layer adapts silently to
changes in the db layer, other code is likely to fail in unpredictable
ways, including silently, whereas an explicit declaration of what
fields are in a table, for instance, will fail with a hard error. But
maybe this is anal retentiveness, akin to a need for strong typing.

js


--
Jacob Smullyan

Jorge Godoy

unread,
Sep 15, 2005, 2:14:38 PM9/15/05
to
Jacob Smullyan <smul...@smullyan.org> writes:

> I have mixed feelings about automagical schema introspection. PyDO
> supports it, and will probably do so increasingly robustly if people
> use it. But part of me feels that "explicit is better than implicit"
> may win out over DRY here, because the ORM layer and the db layer
> exist in different realms, and if the ORM layer adapts silently to
> changes in the db layer, other code is likely to fail in unpredictable
> ways, including silently, whereas an explicit declaration of what
> fields are in a table, for instance, will fail with a hard error. But
> maybe this is anal retentiveness, akin to a need for strong typing.

I just wonder when it becomes bad having to declare everything. For example,
we have databases with 600 tables. Declaring them all again will make a huge
PITA and would not be very helpful, specially because there's already some
declarations at the ER diagrams, at the SQL script, inside the database, and
then again at each and every python class?

Having the introspection is great in this case (even though it is boring
having to declare all those classes and tell them to fetch their structure
from the database it is better than having to "recreate" all of them).

With regards to failures, this is one of the reasons for unit tests :-) They
can help finding out where is the problem and they should never fail
silently.

--
Jorge Godoy <go...@ieee.org>

Jacob Smullyan

unread,
Sep 15, 2005, 3:05:41 PM9/15/05
to
On 2005-09-15, Jorge Godoy <go...@ieee.org> wrote:
> I just wonder when it becomes bad having to declare everything. For example,
> we have databases with 600 tables.
[snip]

> Having the introspection is great in this case (even though it is boring
> having to declare all those classes and tell them to fetch their structure
> from the database it is better than having to "recreate" all of them).

Granted. Also, if the tables share structure, another option would be
to simplify their description with inheritance.

> With regards to failures, this is one of the reasons for unit tests :-) They
> can help finding out where is the problem and they should never fail
> silently.

You are right. I am consoled.

js

--
Jacob Smullyan

Jorge Godoy

unread,
Sep 15, 2005, 3:54:06 PM9/15/05
to
Jacob Smullyan <smul...@smullyan.org> writes:

> Granted. Also, if the tables share structure, another option would be
> to simplify their description with inheritance.

It would be great if relationships could be mapped this way too. Something
like ...

================================================================================
class Person(baseclassForORM):
pk_person = PK() # Dunno, it could be anything...
name = String(40)
birth_date = Date()
sex = String(1)
obs = Text()


Address(baseclassForORM):
pk_address = PK() # Dunno, it could be anything...
person_pk = Person(pk_person) or None # If it can be null...
city = String(30)
state = String(30)


(...)

inhabitant = ''
if (addressInstance.person_pk):
inhabitant = address.name

(...)

================================================================================

(this is a *very bad* example, I just couldn't think of
something simple and better right now)

... would also be interesting but it isn't essential. I believe it is simpler
than inheritance for the ORM tool. Just making it easy to retrieve records
from a related "class" would be great. This is one thing that I like with
SQLObject -- I have never used PyDO, but I'll give it a try -- and getters and
setters :-)

When you go to the field of ORDBMS, it gets even more complicated, since you
can have inheritance on the database side as well...


Ah! Of course one should not forget of mapping views as well. :-) Having
some way to create logic to update the view is nice if the selected database
doesn't support it (e.g. with rules when using PostgreSQL).


But then, I'm far out of Python with this message :-) Sorry.

--
Jorge Godoy <go...@ieee.org>

mal...@gmail.com

unread,
Sep 25, 2005, 1:48:40 AM9/25/05
to
I'm a python guy, so I haven't tried rails myself (I did read the
tutorial though). I tried Django and didn't like it somewhat. One thing
I don't like about it is that you have to write the same things twice,
for ex. specify url resolver and reference it in config. Django is not
bad but not spectacular either. http://www.turbogears.org/ on the other
hand is! I had no CherryPy or SQLObject experience before, but I learnt
the framework and implemented my first web-app with it in one day time!
That includes the model, some views and an xml-rpc control interface.
That's outstanding productivity if you ask me.

You should give TurboGears a try.

Jaroslaw Zabiello

unread,
Sep 25, 2005, 6:57:16 AM9/25/05
to
Dnia 24 Sep 2005 22:48:40 -0700, mal...@gmail.com napisał(a):

> You should give TurboGears a try.

http://www.turbogears.org/about/status.html

"TurboGears should be considered *alpha* software. This means that there
can be *breaking API* changes between now and 1.0." It uses CherryPy
(beta!), SQLObject (beta) and Kid (which has a couple of bugs that need
fixing) This project is good only for fun and playing not for enterprise.

--
JZ

D H

unread,
Sep 25, 2005, 10:06:43 AM9/25/05
to
Jaroslaw Zabiello wrote:
> Dnia 24 Sep 2005 22:48:40 -0700, mal...@gmail.com napisał(a):
>
>
>>You should give TurboGears a try.
>
> ....This project is good only for fun and playing not for enterprise.

That's my kind of project :)

Luis M. Gonzalez

unread,
Sep 25, 2005, 9:09:41 PM9/25/05
to
If you are looking for something pythonic, full featured and very easy
to use, you should check this out: http://karrigell.sourceforge.net

Give it a try and let me know how it goes...

Cheers,
Luis

0 new messages