DEV Community

Cover image for Django vs Ruby on Rails: Web Frameworks Comparison
Django Stars for Django Stars

Posted on • Updated on • Originally published at djangostars.com

Django vs Ruby on Rails: Web Frameworks Comparison

There are more than 90 web development frameworks out there. No wonder it’s hard to choose the one that’ll suit your project best. Still, there are at least two major frameworks that are widely used by the tech giants of nowadays, and for good reason. Ever heard of Django or Ruby on Rails? If both web frameworks are quite good, how do you compare Django and Ruby on Rails to choose which one to use for web development?

Instagram, YouTube, Spotify, Dropbox and other online and app-based services that we use daily are powered by Django, a Python programming language framework. On the other hand, Airbnb, Bloomberg, Shopify, and other leading companies use Ruby on Rails, a Ruby programming language framework. Both languages were created to serve the web and make web applications (including mobile web apps) possible.

In this article, we’ll compare these two popular frameworks. While both are fast and easy to use, Django and Ruby on Rails each have reasons for and against them as the development framework for your future project. As software development professionals we’ve found materials comparing Django vs Ruby on Rails performance, Django vs Ruby on Rails speed too oversimplified, since speed and performance often depend on the complexity of each individual project as well as the proficiency of the development team with the respective technology. What we mean to say is that even if python/ruby/etc are interpreted languages, and are slower in certain workloads, for tasks which are relevant for a web framework this may not matter. So we decided to take a closer look at their pros and cons, as well as use cases to help you decide which one is the best fit for your needs.

Django Pros, Cons and Use Cases

Django is a widely used Python web development framework. It was developed in the fall of 2003 by Adrian Holovaty and Simon Willison as they started to use Python to build applications. It gained its speed, security, and scalability from Python. Pinterest Engineering, Mozilla, Udemy, NASA, Washington Post and other powerful websites all rely on Django. It comes with the most tools and libraries for common use cases – for instance, its authentication, URL routing, template engine, object-relational mapper (ORM), and database schema migrations (Django v.1.7+). Here are some reasons for and against Django.

top-django-based-apps

Read more: 10 Popular Websites Built With Django

Django Pros

Some say that Django’s pros outweigh its cons. Let’s take a look at its main advantages:

django-pros

Rapid and low-cost prototype/MVP development

Django has a flexible, well-structured admin panel that lets you reuse code from one project to another. Besides, there are plenty of out-of-the-box libraries that can help you build a product prototype or an MVP fast.

Explicit, logical syntax

The Django framework is easy to build on, easy to work with, and easy to support. It’s based on Python, which is considered one of the easiest development languages to learn. Besides, it is easy to debug and read, which means it’s not going to be a problem for new team members to catch up with a project in mid-stream.

An extensive open-source ecosystem

Being an open-source ecosystem means that numerous tools and libraries, both free and paid, are available for everyone at any time. Django’s official documentation is more than enough to find solutions if you’re stuck. Besides, there are plenty of helpful forums such as Stack Overflow or the Django community of Reddit, where developers find answers to their Django-related questions.

Django Admin portal

This built-in admin panel is a great tool for easier management of the backend user interface. It is well structured, and has permissions and authentication modules out of the box. Besides, it’s easy to customize by adding custom CSS or replacing the default templates.

Django’s REST framework

django-rest-framework

REST stands for Representational State Transfer, and it lets you easily build APIs. It’s powerful enough to build API in just 3 lines of code, and flexible enough to return multiple data formats and handle different types of calls. Basically, the Django Rest Framework gives you a lot of convenience, such as authentication modules, JSON serializers/deserializers, API routing, and documentation, etc. You could argue that when comparing Django vs Rails performance in an API-heavy project, the REST-based architecture is among the most evident Django/Python Pros.

Although Django has many advantages, there are also a couple of downsides:

Requires more code upfront

Django developers have to write more of the code themselves. As a result, they are more conscious, purposeful, and demanding of the business goal. This freedom from hard presents, on one hand, can be considered one of the main Django/Python cons.

Django is monolithic

Django is a full-stack framework with a monolithic approach. Basically, it is the other side of a ready-to-use, out-of-the-box solution. Django pushes developers into certain patterns within a framework. This is also the reason why Django is the choice for large, tightly-coupled products. The Django framework is a single package where all components are deployed together, so you can’t pick and choose bits and pieces.

Django Use Cases

Django is widely used for e-commerce websites, healthcare, financial applications, social media sites, transport & logistics and more. Here are the main areas where Django is applied:

  • Travel and booking systems with complex, fine-tuned customizations;
  • Platforms with complex API architecture and that rely on data from third parties;
  • Content, data, and e-commerce management engines with custom rules;
  • Other web apps with dynamically changing complex algorithms.

Read more: Why We Use Django Framework & What Is Django Used For

Django Summary Table

Screen-Shot-2019-10-03-at-7-55-59-PM

Ruby on Rails Pros, Cons and Use Cases

Similarly to Django, Ruby on Rails (RoR) is also an open-source framework. It lets developers use ready-made solutions and therefore, helps them save time on programming processes. David Heinemeier Hansson, the founder of Ruby on Rails, powered his own web application Basecamp with the Ruby framework. Other famous websites built with Ruby on Rails include Twitter, GitHub, Yellow Pages, and more. So, how does one compare Ruby on Rails vs Django?

Based on the Ruby language, Ruby on Rails inherited its parent’s logic and simplicity. Basically, Rails is a layer on top of Ruby that helps developers build web applications. It’s a very popular choice for backend solutions, and there’s a comprehensive guide – “The Rails Way” – to building production-quality software with Rails.

As a fully fledged framework, it offers an ORM (Object Relational Mapping) system for business data and logic, application management, and routing out of the box. It is a popular choice within Silicon Valley (big Valley startups based on RoR are Airbnb, Etsy, Spotify, etc.) – and now we’re going to take a closer look at it to know why.

top-ruby-on-rails-based-apps

Ruby on Rails Pros

Ruby on Rails is indeed one of the most popular web development frameworks. Here are the main benefits of Ruby on Rails:

ruby-on-rails-pros

Component Structure Based on Plugins and Gems

Ruby on Rails’ component structure, based on plugins (application level) and gems (system level), lets experienced RoR developers quickly put together efficient applications with less coding. The plugins are well documented and easy to use. New gems are constantly added to public repositories, such as the popular RubyGems resource, which currently contains more than 150,000 total gems for download.

Easy to Migrate and Modify

In fact, any fundamental changes to the codebase don’t require many changes in the application code. RoR code is of high quality and can be easily read. Ruby on Rails developers don’t have to micromanage it.

Diversity of Presets and Tools

There are lots of must-have features that are already preconfigured. Ruby on Rails provides developers with multiple standard web features and patterns, which significantly speeds up the development process.

Testing Environment

When complex testing logic is the core of the product, RoR’s superior testing environment is a great help. Developers can make sure their apps work as desired using testing and debugging tools, as RoR makes it easy to build automated tests and get all aspects of the product checked.

Ruby on Rails Cons

Along with advantages, come the downsides. Here are some of them:

Faster Complexity and Tech Debt Buildup

Ruby on Rails’ flexibility has a downside. Basically, with so many ways to code the same outcome, code can get difficult to read and may require a steeper learning curve as well as more rework later on.

More Difficult-to-Create API

Building an API with Ruby on Rails can be incredibly complex, as RoR has no equivalent to Django’s REST framework.

Documentation Quality and Standards Vary

With Ruby on Rails, it may be hard to find good documentation, especially for “less popular” gems. Most of the time, there are “test suites” that serve as the main source of information for developers. They have to study the code instead of simply reading the official documentation (which is not there).

Ruby on Rails Use Cases

RoR is widely used for creating prototypes and MVPs. On top of that, it’s very popular in the startup community. According to SimilarTech, more than 402,000 websites are powered with RoR. Here’s an overview of the main areas where Ruby on Rails is used:

  • Relatively self-sufficient systems without much third-party data exchange;
  • Platforms with dynamically changing rules that need to be re-tested frequently;
  • Content, data, and e-commerce management engines with relatively standard feature-set requirements;
  • Other CPU-intensive web apps.

Ruby on Rails Summary Table

Screen-Shot-2019-10-04-at-1-02-54-PM

Django Framework vs Ruby on Rails Framework Comparison

Both Django and Ruby on Rails are great web development frameworks. They can deliver modularized, clean code and significantly reduce the time spent on common web development activities. Both of them follow the MVC principle, which means modeling of the domain, presenting the application data, and user interaction, all separately from each other. The question then is: how do you pick which framework to use? The decision may come down to which language you prefer or which software development principle you want to follow: to rely on sensible defaults, such as Ruby’s convention-over-configuration principle, or to follow Python’s “explicit is better than implicit” principle. The answer is simple — you can’t really go wrong by picking either one.

Here’s a comparison table of the two frameworks as a reminder of the main attributes of each:
Screen-Shot-2019-10-04-at-1-03-35-PM

When thinking about long-term prospects of a technology stack it’s common to evaluate the strengths of each tech community and compare django vs ruby on rails popularity among the software developers. In fact, there is no perfect front-end framework out there. Your choice should always rely on your business goals and objectives. Having said that, Django, for instance, was included in the list of the most preferred frameworks among DevOps in a StackOverflow survey in 2018. It was and remains popular as well, according to the Python Developers Survey of 2018.

Based on Python, one of the top programming languages currently in demand, Django is used by thousands of programmers every year to build various web applications. It’s compatible with major operating systems, scalable, and easy to understand. It has a lot of features to simplify development and a large, helpful community.

The framework of your choice should serve your business needs and fit into the industry ecosystem — and not because of hype, your friend’s advice, or ease of hiring, but because it suits your project’s objectives. Study the purpose of a framework beforehand, as some frameworks are a good fit for gaming applications; others, for example, lean towards e-commerce websites.

You should approach this fundamental decision carefully and strategically. It’s hard to simply switch programming platforms in the middle of development, as it takes time, is risky, and also quite expensive. So, choose the main platform, but consider whether its core library is flexible and adaptable, in case you need to make any modifications in the future.

On top of that, deciding what framework to use is a strategic investment for the company. It should not be solely a CTO’s or an IT department’s decision, but rather one that considers the elements of the desired framework at all levels.

Our team has worked with Django almost since its inception. We have been actively contributing to the community over the years and have broad experience with it – starting from basic features and navigating around weaknesses, to creating MVPs that help startups get venture-capital funding and scaling web services that have become #1 market leaders in their region.

So, if you have a product idea in mind, let’s discuss how to make it into a web product with Django!

This Django vs. Ruby On Rails comparison was originally posted on Django Stars blog.

Top comments (18)

Collapse
 
andrewbrown profile image
Andrew Brown 🇨🇦 • Edited

I'm very sorry but this comparison of Pros and Cons is superficial and inaccurate of these two frameworks. Just to prove my point on one point listed above (with factual proof):

Ruby on Rails Documentation

Ruby on Rails has excellent documentation. This article purports that the quality of documentation varies so implicitly applies that Django has better documentation. This is not true. When comparing Ruby on Rails documentation with Django. RoR wins.

Compare the security pages documents. You will see Ruby on Rails dots the eyes on everything where you need to go digging with Django.

guides.rubyonrails.org/security.html
docs.djangoproject.com/en/2.2/topi...

The Rails API is thoroughly documented.
api.rubyonrails.org/

I can't even find the Django's API. So after searching for 5 mins I can't find an equivalent for Django that documents things. You could easily mistake this being the API Reference:

But all get is lock documentation on the components but not at the code level. You know why? Because Django does not document their API. You simply browse the codebase on GIthub to tell.

Look at Rails. They a very through describing how all their code works:

Browse as much as you may you will not find it in Django.

Collapse
 
davidmm1707 profile image
David MM👨🏻‍💻

I love Django, and most Django developers love the docs, but I dislike it.

It is well written, but the information is dispersed. Sometimes to do something, you need to look for information in 3 or 4 pages.

I would like to see something like Flutter, for example, on ListViews we have:

api.flutter.dev/flutter/widgets/Li...

The class, a lot of examples, to the right we have the constructors, properties, methods, etc.

Collapse
 
cadetstar profile image
Michael Madison • Edited

I also argue against the statement that Rails does not have a REST capability... the default routing for a given resource follows REST conventions, and in Rails 5, you can spin up a Rails app in API mode that slims down the gems installed (removing the templating and asset gems, e.g.), and optimizing the stack for restful API actions

Collapse
 
kwstannard profile image
Kelly Stannard • Edited

Maybe the author has never seen Rails used in the default way? I have seen apps that take make use of the defaults.

Collapse
 
gbudiman profile image
Gloria Budiman

This is true. Our company has 12 Rails microservices, all running in API-only configuration.

The author obviously has mediocre experience with Rails and writes articles based on hearsays.

Collapse
 
ohaddahan profile image
ohaddahan • Edited

As someone who works daily with both frameworks, and unlike you I don’t self identity myself as “framework stars” I can claim without bias that this article is wrong on many points, inaccurate, very biased and unprofessional.

Collapse
 
mdoyle13 profile image
Mike Doyle

Man, I am sick of these types of articles....

Collapse
 
kickbuttowski80 profile image
Izak T

amen to that .
no one talks about fundamentals any more.

Collapse
 
mdoyle13 profile image
Mike Doyle

right. i usreRoR daily. I've built things in Django in the past. Pick the right tool for the job based on other factors like your team's competencies, long term business plans etc. You can build the same thing in both frameworks. It does not matter.

Thread Thread
 
kickbuttowski80 profile image
Izak T

amen to that.🙏🙏🙏
I just decided to stick with ror and not jump from one language or teconogloy to another one. trust me tomorrow paython will be useless and something else will be better. I wanna focus on algorithm , design patterns and so on.

Collapse
 
juanmanuelramallo profile image
Juan Manuel Ramallo

Building an API with Ruby on Rails can be incredibly complex, as RoR has no equivalent to Django’s REST framework.

🙈

guides.rubyonrails.org/api_app.html

Collapse
 
teaglebuilt profile image
dillan teagle

I am personally not a fan of Ruby on Rails. I think Django is great. If you do like the Controller style, there is a python framework called Masonite that implements controllers like Ruby on Rails.

docs.masoniteproject.com/
github.com/MasoniteFramework/masonite

Collapse
 
exadra37 profile image
Paulo Renato

This is an excellent article about the pros and cons of using both frameworks. Kudos for it :)

Without wanting to diminish the above frameworks, I would like to call the attention for a new contender on the block, that is worth to also consider, the Phoenix framework that is built in the Elixir programming language, that runs on top of a battle tested ecosystem, with around 30 years of existence.

Ruby on Rails developers will fill more at home with Phoenix, because their developers come from Ruby, but Python developers will not fill lost.

Maybe you could evaluate the pros and cons of Phoenix against Django and Ruby on Rails in a future article?

Collapse
 
lewy_blue profile image
Lewy Blue | Discover three.js

I don't think Reddit uses Django, where did you get that info?

Collapse
 
davidmm1707 profile image
David MM👨🏻‍💻
Collapse
 
lewy_blue profile image
Lewy Blue | Discover three.js

The framework that seems most promising is Django and indeed we initially attempted to rewrite Reddit in it.

...and the entire rest of the article is spent criticising Django and explaining why they would never use it.

In that article (from 2005!) they say that use web.py.

Collapse
 
steelwolf180 profile image
Max Ong Zong Bao

This is really a good summary of the main points of what to select between Django or Ruby on Rails

Collapse
 
davidmm1707 profile image
David MM👨🏻‍💻

Requires more code upfront

I would like to see something like Class Based Views in other frameworks.