3 ms·
I don't want to start a rails vs Django conversation, but why do you prefer Django over rails? I'm a rails dev and am just curious where Django is at with thing
by jbhatab 11y ago
I don't want to start a rails vs Django conversation, but why do you prefer Django over rails? I'm a rails dev and am just curious where Django is at with things.
- ralmidani 11y agoA little bit of background: I learned Django first. Then I learned Rails via Code School, and flirted with building my app with Rails instead of Django. I saw the asset pipeline specifically as a Rails advantage over Django (I write Emblem, indented Sass, and CoffeeScript whenever I can avoid HTML/Handlebars, CSS, and JS). Also, building JSON APIs with Rails has better out-of-the-box support than it does in Django. I always felt Rails' model layer is clunky compared to Django's. What is the definitive representation of my model? The validations in SomeModel < ActiveRecord::Base or what's automatically generated in schema.rb when I run migrations via Rake? In Django everything, including migrations (in simple cases), is derived from the classes in models.py. But I thought it would be worth it to persevere, due to the above-mentioned advantages. Then I realized I could (and should) compile assets via Ember-CLI, and Django Rest Framework is just a pip install away. So the two main advantages of Rails disappeared, and switching back to Django became, for me, a no-brainer. Edit: I also prefer Django's less magical approach. This may seem ironic given my love of Ember, but Ember's magic is easier for me to understand than that of Rails.
- JohnBooty 11y agoPersonal opinion, obviously, but I also find Rails to be way too magical sometimes.
- dasil003 11y agoI am also a Rails dev, but one feature I think Django really got right that is head and shoulders above Rails are Form Objects (https://docs.djangoproject.com/en/1.9/topics/forms/ https://docs.djangoproject.com/en/1.9/topics/forms/). Rails' attr_accessible stuff and even strong_parameters really pales in comparison.
- ralmidani 11y agoI do rendering on the client-side, so do not use Django's Forms. But there are ModelForms which integrate seamlessly with your model because it is the definitive representation of a real-world object. Similarly, Django Rest Framework has ModelSerializers and ModelViewSets which give you a lot of free functionality out-of-the-box precisely because Django's Model layer was designed with DRY in mind.