When comparing Grails vs Django, the Slant community recommends Django for most people. In the question“What are the best web frameworks to create a web REST API?” Django is ranked 6th while Grails is ranked 28th. The most important reason people chose Django is:
Django's philosophy of batteries included means that experienced developers won't have to plan too much ahead on what kind of application infrastructure they need and instead just start developing web applications quickly.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Grails is highly scalable
Grails is an abstraction over Spring and Hibernate. This makes Grails applications fast and scalable. This is because both Spring and Hibernate are themselves scalable.
Pro More than 900 plugins
Grails is a full-stack web framework, not just MVC. It contains a lot of stuff out of the box, but it doesn’t enforce it. It contains over 900 plugins which provide a Groovy API for a lot of useful and well-known Java libraries. And what is more important is that they are super easy to install!
Pro Very fast setup and scaffolding
Setting up a new project is quite fast and code generation (scaffolding) saves you a lot of time. It also uses a convention over configuration principle which helps you bypass all the configuration trouble.
Grails also comes with a reloading mechanism out of the box.
Pro Easy to use
Grails is designed to be a rapid development framework with a straight learning curve. It advocates convention over configuration. Extensibility is very simple when using plugins (there is a lot of them). One command in the console – and all the dependencies and configurations are managed for you.
Pro Great UI design alternatives
Do you need something advanced in the UI? You can either create it in GSP with an addon of CSS/JavaScript or you can find a plugin that will do the work for you. Plugins include integration with Bootstrap, jQuery, Yeoman and much more.
Pro Great documentation and community
The Documentation section is actually a wiki, which can be modified by any logged in user. It has an official manual, tutorials, screencasts, a sample app and much more. If that does not do it for you, then there are countless third-party tutorials, more than 12k questions on SO and much much more
Pro Developing a simple prototype can be very fast
Django's philosophy of batteries included means that experienced developers won't have to plan too much ahead on what kind of application infrastructure they need and instead just start developing web applications quickly.
Pro ORM support out of the box
Django supports Object-Relational Mapping. With models defined as Python classes which are actually subclasses of Django's django.db.models.Model
.
Each attribute of the model is then represented as a database field. Queries are lazily executed and Django gives developers an automatically-generated database-access API.
Pro Top notch documentation and help from community
The official Django documentation is probably some of the best around. Well written, thorough and they explain every little detail of the framework. Django is also a very popular tool, with an extensive community and a lot of experienced developers that have been using it for years. This means that there are a lot of guides and tutorials out there for new and experienced developers alike.
Pro Highly customizable
Django is in itself a highly customizable web framework. The database, template framework and ORM can all be swapped out.
Pro Has an admin panel out of the box
Django comes with a highly customizable admin panel and authentication out of the box. This makes the development and production of a simple CMS extremely easy.
Pro Mature software with many plugins developed over the years
Django was first released in 2005, it has had a lot of time to mature and become better with each release. It also has by far the largest community out of all python frameworks who have continuously over the years built and maintained many powerful plugins.
Pro Clear and defined MVC organization
Django follows some pretty well established MVC patterns. With everything in place and where requests follow a clear path through urlresolvers, middleware, view and context processors.
Pro Simple database management
Just a few lines of code can instruct Django to create all the tables and fields required in your database automatically. Schemas are managed with "migrations", that are also created automatically, and can be rolled out from your development box and implemented on production systems with just a single command.
This performs any database changes required, from table creation, indexes, renaming fields, and pre-populating initial data. Each migration builds on the previous migrations, so you can trace the evolution of your data and even recreate the layout of your database at any point in the lifecycle of your application.
Cons
Con Grails is a fairly complex framework
Grails is a pretty heavy piece of software. It's functionality is covered by GORM (Grails' Object Relational Mapping) which is a facade for hybernate and by Spring MVC.
Everything is glued by core Spring and furthermore, Grails adds another level of abstraction on top of all this. These things may create some trouble down the road when debugging.
Con Too obtuse and JVM centric
If you're a big fan of the JVM and have mastered all its goofy quirks, Grails might be a good choice, but there are other frameworks out there that are more straightforward and easier to use.
Con Can feel bloated for small projects
Django's sheer scale and functionality can feel clunky and bloated for small applications. It has too many bells and whistles which can get in the way when developing a small scale application.
Con The documentation does not cover real-world scenarios
It is a larger documentation indeed, however is not deep and covers non real problems or even don't show any examples. You'll be better with Google or Stackoverflow
Con Routing requires some knowledge of regular expressions
Given a GET request for /topics/426/viewpoints/1/sections/create
, how does Django decide which bit of Python code is invoked to handle it?
It compares the request path to your giant pile of regular expressions.
And then if there's some other regular expression starts matching /top
and all your requests for /topics/
start going there, good luck figuring out why. You won't be informed of any conflict until you notice you seem to be getting the wrong pages back.
The structure of URL paths is almost universally hierarchal. There is no call to have anything as ridiculously flexible (and notoriously hard-to-read) as regular expressions to organize request routing.
Con Template errors fail silently by default
If you make a typo in a template variable, or change a view so that variable is no longer passed to the template, you won't get an error message pointing out that something has gone wrong. That reference will just be treated as if it is an empty string instead.
There is a way to configure this, but since so many templates have been written assuming this behavior, nobody ever enables template errors because it would break so much of the existing support tools (e.g. the built-in admin interface).