46 ms·
I prefer Django for the same reason I prefer Python — Django is more explicit, there's less 'magic', and it's easier to figure out what's going on when somethin
by beatpanda 14y ago
I prefer Django for the same reason I prefer Python — Django is more explicit, there's less 'magic', and it's easier to figure out what's going on when something goes wrong.
One example is model definitions — in Django, the canonical definition of a model's database schema is in an app's models.py file. I'm still not sure where to look for this in Rails.
Additionally, other tools you decide to use with Django don't require any extra "Django magic" to work — they work the same as they would if you used them alongside any other tool.
One example is using Less with either framework. Using Less's `less.watch()` functionality, which enables live updating in the browser based on changes in your .less file, is much more difficult to use in the Rails asset pipeline, in my experience.
There's pretty much feature-for-feature parity at this point, and where it doesn't exist there's a plugin or other supplemental tool. For Django, pip, south, and django-mediasync cover for bundler, migrations, and the asset pipeline (sort of). And of course there's a rails admin gem.
But these are the same tradeoffs that have always existed, and I don't think any of them have changed in the new versions.
- jarrett 14y ago> canonical definition of a model's database schema...I'm still not sure where to look for this in Rails. db/schema.rb has that. > Using Less's `less.watch()` functionality, which enables live updating in the browser based on changes in your .less file, is much more difficult to use in the Rails asset pipeline, in my experience. I have found that to be difficult too. It think it's because Less has fallen out of favor, and SCSS is the new standard. It's actually super easy if you're willing to use SCSS. You mentioned Django plugins providing an asset pipeline. Do you feel that it's easier to start supporting a new asset type in Django's pipeline than in Rails'?
- beatpanda 14y ago> LESS has fallen out of favor Eh, I don't know, Twitter bootstrap users don't appear to agree. I know it's fallen out of favor for DHH, but I don't know if that's generally true. > You mentioned Django plugins providing an asset pipeline. Do you feel that it's easier to start supporting a new asset type in Django's pipeline than in Rails'? No idea, because I've never tried to do it, but the one I was referring to seems to make it pretty easy: http://sunlightfoundation.com/blog/2011/01/20/django-mediasync_2/ http://sunlightfoundation.com/blog/2011/01/20/django-mediasy...
- jarrett 14y ago> Eh, I don't know, Twitter bootstrap users don't appear to agree.. I know it's fallen out of favor for DHH Yeah, that's all I mean. I agree that it hasn't necessarily gone away in the larger sphere. Just that the Rails community has moved to a different default, so LESS gets harder to use. I personally am glad, though. I find SCSS more powerful. See, for example, the if statements and loops it gives you: http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#control_directives http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#co... For another example, around the time when Rails made the switch, I started running into serious problems using media queries with LESS, whereas they've always worked great for me in SCSS.
- nobleach 14y agoIt's not user defined in db/schema.rb. When using migrations, the schema is written to that file. It's entirely possible to bring a legacy database to the app and never create a migration. Rails just reads the table definitions from the database. I think the schema.rb file CAN be used to build the database though... I'm trying to remember. I feel like I've done that before. This is good and bad. Good because it saves the developer from describing something that's already described in another area. Bad because it takes away a bit of control. My Django apps had a bunch of legacy tables that I was forced to sit and document. I had to remember to go back and add another line every time I added another field. But, to be honest, it's pretty much the same way with most other frameworks I use.
- jarrett 14y ago> When using migrations, the schema is written to that file. You can also run rake db:schema:dump at any time. So it works great with a legacy database. You don't need to run any migrations for this to work.