Scott's Recipes Logo

Django vs Rails 04 - Verifying the Django ORM is Working in the Shell

Note: I’m assuming a class named SourceClubProduct as the example here.

In a Rails app if you want to verify that ActiveRecord is running, here’s all you need do:

bin/rails c 
SourceClubProduct.first

Here’s the Django equivalent:

python manage.py shell_plus
from manager.models import SourceClubProduct
SourceClubProduct.objects.first()

When someone recently asked me how I liked Django, I referred to it as:

Django feels to me like getting in bed with my shoes on

And this micro example nicely illustrates this – there is substantially greater cognitive load on the developer in terms of minutiae and syntax with Python and Django than Rails.