6 ms·
What does Django offer that you feel is an improvement over Rails? I'm asking out of curiosity because I have very little experience with either.
by chiyc 5y ago
What does Django offer that you feel is an improvement over Rails? I'm asking out of curiosity because I have very little experience with either.
- m_ke 5y ago+ Python (larger user base, more libraries, especially for scientific computing / ML) + Less Magic + Better Migrations + Better ORM + Django Rest Framework + Admin Interface + Great Documentation - Less Packages
- realusername 5y agoBetter ORM and better migration? That has to be a joke, that's the weak point of the framework... Yeah there's less magic I give you that, but also because it does much less. Also for me the Python packages are a minus, they are usually not tested very well and it's very easy to burn yourself when migrating (good luck finding some equivalent of rspec)
- aeonflux 5y ago> Migrations are a solved problem in Django Still, no information how they are better than the migrations in Rails?
- bliteben 5y agoThey are automatically generated from the model. It presents some warts etc, but works pretty well. It basically does require some hooks to ensure that developers don't work on the same migration at once, but not a big deal.
- airstrike 5y ago> Better ORM and better migration? That has to be a joke, that's the weak point of the framework... That was probably only true 6–10 years ago. Migrations are a solved problem in Django and I can only think of one very obscure query that I couldn't get done in the ORM and had to drop into raw SQL. Aggregations, annotations and other query expressions in general have lifted the ORM to a truly strong position
- realusername 5y agoI've made a full project about 2 years ago with Django, unless things are improved since then or I'm too inexperienced with the framework it still does not compare to activerecord. Where are my scopes? Where's the equivalent of strong_migrations? The equivalent of db_consistency? Where are delegate attributes? Concerns? Arel? The ORM isn't bad I'll admit that but some complex features are tedious.
- m_ke 5y agoLast time I used Rails was like 8 years ago so I'm not up to date on the changes to their ORM but when it comes to django the ORM is pretty top notch, especially when it comes to Postgres support. I've never used rspec but it sounds like pytest and hypothesis would do the job. In ruby there's no hope for pytorch / tensorflow / ray / numba.
- realusername 5y ago> I've never used rspec but it sounds like pytest and hypothesis would do the job Sorry it really does not, having factorybot + rspec + rspec-mocks really is a super power when it comes in testing. The issue is that most of the time I land on a django project, it has really poor testing whereas most of the time I land on a Rails project, it has very close to complete testing. The reason is that the tests are more tedious to write. And this culture trickles down to your dependencies as well. Anything you install with rails is almost guaranteed to have the upmost quality of testing.
- m_ke 5y agoTesting django with pytest is super easy (ex: https://dev.to/sherlockcodes/pytest-with-django-rest-framework-from-zero-to-hero-8c4 https://dev.to/sherlockcodes/pytest-with-django-rest-framewo...)
- realusername 5y agoIt's nowhere near as equivalent, where's the behavior testing? Where is stuff like allow_any_instance_of(...).to receive(...).and_return(...)? What about shared examples? How can you patch globally the current time? Where are partial matchers like an_object_having_attributes? What about automatic db rollbacks? Have a look on the examples here https://github.com/rspec/rspec-mocks https://github.com/rspec/rspec-mocks
- p8 5y agoAndrew Kane wrote gems similar to popular ML libraries which are wrappers around C code: https://ankane.org/new-ml-gems https://ankane.org/new-ml-gems pytorch: https://github.com/ankane/torch.rb https://github.com/ankane/torch.rb Tensorflow: https://github.com/ankane/tensorflow-ruby https://github.com/ankane/tensorflow-ruby
- marcosdumay 5y agoYeah, the one largest difference is about magic. Rails chases it by default, Django avoids it by default. I wouldn't say that the ORM is better (in fact both ORMs are bad), but the way it integrates with everything is just awesome.
- aeonflux 5y ago... source for this is "Last time I used Rails was like 8 years ago" (from following comments).
- Toutouxc 5y agoI respect that and may Python and Django work for you forever, but some of those sound like what cat people would say about dogs and vice-versa.
- m_ke 5y agoFor sure, I'm not trying to trash Rails, it's a great framework. My background is in Computer Vision and Machine Learning, where python shines, making Django an obvious choice over Ruby and Rails. The question I was replying to was "What does Django offer that you feel is an improvement over Rails?" and I tried to answer it.
- Toutouxc 5y agoOh, sorry, I missed the "you feel" in the grandparent post.
- cure 5y agoYou forgot a very important one - Python package management (a raging dumpster fire)
- abledon 5y agoi always found gem bundle stuff with rvm more obtuse than pip and site packages... python with virtualenvs seemed more straightforward
- marcosdumay 5y agoOn Linux, you settle on a single interpreter, and makes a virtualenv for each project. Make sure to never install anything systemwide. On Windows, get used to your system being broken (oh, no problem, you already are), but it won't be because of python. That's basically the same instructions you will have for ruby and javascript. Ruby package management is about as good as python's, while javascript is a toxic wasteland. There are languages with better dependency management, and languages with worse ones (ok, not worse than javascript, no dependency management is still better than javascript). But python and ruby do not have much difference.
- globular-toast 5y agoI've never had a problem with it. You just need to use virtual environments.
- m_ke 5y agoVery true but with conda and docker it's not as bad for production as it used to be. Most of the packaging issues that I run into these days are related to CUDA / C++ libraries, plain python dependencies are not really an issue.
- sigzero 5y agoIs Ruby any better in that category? Just asking. I really have no idea and what to know.
- bliteben 5y agopretty sure they aren't split between 3-4 packaging styles
- johntdaly 5y agoFor some people Python is not a plus, usually for us Ruby guys. I did like Python a lot more though before I found Ruby but afterwards Python became sort of “practical” and unexciting. We usually also want the “magic”. I can’t argue with you about the ORM and Migrations since I haven’t used Django much. The feeling I get though comparing the two is that Django is more fixated on building business facing backends and Rails is more focused on building customer facing frontends. Over all I would recommend figuring out if you are more of a Python/Django of Ruby/Rails type. It will tell you something about your personality.
- bliteben 5y agoWhile I love Django's backend I have found a few clients balk at its general style and non-responsive design, even for un-exciting admin tasks such as approving new objects etc. As far as getting things done, well its probably the best admin site out there. > Over all I would recommend figuring out if you are more of a Python/Django of Ruby/Rails type. It will tell you something about your personality. That's a great insight and probably very true.
- johntdaly 5y ago> While I love Django's backend I have found a few clients balk at its general style and non-responsive design, even for un-exciting admin tasks such as approving new objects etc. It is sort of sad but understandable. That's why I usually don’t go with an admin framework like ActiveAdmin in Rails. It isn’t that hard to build some general functionality for the admin interface. And the admin interface frameworks I’ve worked with in rails where hell when you needed something special and in my experience there are always a lot of special cases. Sure you get a less consistent interface and you can argue about how much more work you have to put in to the admin interface when compared to using a gem but you can shut up the customer request quickly and just move on with the none bikeshedding part of the work.
- aeonflux 5y agoI've worked with both Rails and Django extensively, finally I phased out Django few years ago. Can't really compare those anymore, since too much time has passed. Whats better about ORM and Migration? What so good about Django Rest Framework compared to rails-api?
- m_ke 5y agoI find the ORM API in django to be very clean, especially when combined with custom querysets. It also has great postgres support (https://docs.djangoproject.com/en/4.0/ref/contrib/postgres/ https://docs.djangoproject.com/en/4.0/ref/contrib/postgres/). The migration framework just works, I can't really compare it to rails because I haven't used rails in a long time. DRF seems much more fully featured than rails-api, it comes with a browsable API and OpenAPI integration.
- aeonflux 5y agoYou love Django, I get it. You wrote it its better than Rails in various aspects without actually having a clue about Rails. Thats neither professional nor informative.
- m_ke 5y agoI replied to "What does Django offer that you feel is an improvement over Rails?", the pluses and minuses that I listed are what I "feel" Django has over rails. Again I don't mean to trash on Rails, it's a great framework and miles ahead of anything you'd find in the nodejs ecosystem.
- BeFlatXIII 5y agoThat admin interface is why Django remains my go-to. I keep meaning to make a real project in Phoenix, but that admin interface is too good to give up.
- midrus 5y ago- No assets pipeline - Terrible templating system - No equivalent to hotwire/livewire/liveview - No built in jobs/scheduling system - Insanely bad packaging and dependencies system