When comparing Play Framework vs Flask, the Slant community recommends Flask for most people. In the question“What are the best backend web frameworks?” Flask is ranked 1st while Play Framework is ranked 9th. The most important reason people chose Flask is:
Even though it's pretty minimalistic out of the box, Flask still provides the necessary tools to build a quick prototype for a web app right after a fresh install. With all the main components pretty much packed in the `flask` package, building a simple web app in a single Python file is as easy as it gets.
Ranked in these QuestionsQuestion Ranking
Pro Asynchronous Core
Pro Interoperable with Java
It's like Java, but more Haskell-y.
Pro Good documentation and a great community
Play has quite a large community which provides numerous tutorials and videos related to developing with Play.
The Play official documentation covers many things, such as the framework itself but also specific stuff such as Akka, SBT and Netty.
There are also many big companies that base their main sites around Play, one of them is LinkedIn which provides third-party documentation on a regular basis.
Pro Simple for beginners
Play is very simple to get started. The documentation is very helpful for beginners and advanced users alike and the official website has a great "Getting Started" tutorial to begin developing with Play.
Pro Play is an extensive ecosystem
Play uses Akka for concurrency, Scala for a templating engine, Netty as a client-server framework and SBT (Simple Build Tool) for building. And they all come out of the box.
Play also comes with the option to scaffold your applications. Play is an all-embracing ecosystem designed to increase developer productivity and shorten development times.
Pro Readable code
Play framework's convention over configuration methodology makes most Play projects have a very similar structure. This means that the code written for the framework is very readable. This enables a developer to switch between applications without having to relearn the ecosystem for every project. The built-in templating system also helps with code and makes it possible to have a very low count of lines of code.
Pro Good Websocket Support
Pro Can use Java, one of the most widely known languages
Java is one of the most widely known languages, so people coming from that background can jump right in and not have to learn a new language syntax.
Pro Extremely easy to build a quick prototype
Even though it's pretty minimalistic out of the box, Flask still provides the necessary tools to build a quick prototype for a web app right after a fresh install. With all the main components pretty much packed in the
flask package, building a simple web app in a single Python file is as easy as it gets.
Pro Lots of resources available online
Flask is one of the most popular Python web frameworks, if not the most popular one. As such, there's plenty of guides, tutorials, and libraries available for it. A large number of important Python libraries, such as SQLAlchemy have libraries for Flask, which add valuable bindings to make the development process and the integration between these libraries and Flask as easy as possible.
Pro Minimalist without losing power
Flask is very easy to get up and going, with vanilla HTML or with bootstrap pieces. It doesn't take much lines of Python to load Flask to get headers working, etc, and since it's all modular you don't have to have something you don't want in your application.
Pro Very flexible
Flask gives developers a lot of flexibility in how they develop their web applications.
For example, the choice of not having an ORM, but instead choosing one suited to the task, or another area where Flask gives a lot of options to developers is the templating. They can use Jinja2, Flask's default templating language or choose from a number of different templating languages they desire.
Pro Great documentation
The official documentation is very thorough and complete. Everything is explained in-depth and followed by extremely well-explained tutorials that tackle real-world problems.
Con Backward incompatibility
The jump from Play 1 to Play 2.x caused a lot of confusion. While it is important to have some kind of evolution, sometimes it causes backward incompatibility which can create some problems. It makes tutorials or modules made for the old version obsolete. This can make it hard for beginners to find useful resources. The template engine which used Groovy now uses Scala.
Con Not as many resources to learn
Other languages and frameworks have countless tutorials, books, moocs, etc. Java and Play does not have nearly as much.
Con Not async-friendly
Flask is explicitly not designed to handle async programming.
Con Threadlocals and globals used everywhere
The default way of creating applications in flask makes it hard to use reusable and clean code.
Con Setting up a large project requires some previous knowledge of the framework
Setting up a large project with Flask is not that easy considering how there's no "official" way of doing it. Blueprints are a useful tool in this regard but require some additional reading and are a bit tricky to get right for a beginner.
The lack of some defaults can also be problematic. Having to choose between different libraries for a certain task is never easy, especially if you have never worked with Flask before.