Compare Flask and CherryPy

Flask is a Python web framework for building web applications. It is based on Werkzeug and Jinja 2. It is a minimalist, 'no batteries included' framework. Yet it can be scaled extensively and support complex applications and use cases by adding required functionality as needed. It follows the philosophy that if something needs to be initialized, it should be initialized by the developer.

CherryPy allows developers to build web applications in much the same way they would build any other object-oriented Python program. CherryPy has built-in tools for sessions, static files, cookies, file uploads, caching, encoding, authorization, compression, and many more.

Let's see how Flask and CherryPy compare on various factors and features and which to choose when.

Flask

CherryPy

Overall

Type

Type
Python microframework for building web applications.
Type
A minimalist, object-oriented and popular web framework for Python.

Author

Release Date

Release Date
2010
Release Date
2002

License

License

Website

Website
Adoption and Ease of Use

Popularity [?]

Popularity [?]
5 Stars
Used by 397,000 projects.
Popularity [?]
1 Star
Used by 6,600 projects.

Used by

Used by
Netflix, Zillow, Lyft.
Used by
Used in production services at Netflix and Hulu

Jobs [?]

Jobs [?]
4.5 Stars
1067 job openings which list Flask as a requirement.
Jobs [?]
0.5 Star
16 job openings which list CherryPy in the job description.

Performance [?]

Performance [?]
5 Stars
Because it is minimal and doesn't have a lot of overhead, Flask is very performant. Extensions could impact performance negatively.
Performance [?]
5 Stars
Very fast. Extensions could impact performance adversely.

Flexibility

Flexibility
5 Stars
Very flexible and doesn't require users to use any particular project or code layout. (A structured approach is still recommended.)
Flexibility
5 Stars
Very flexible and simple. Doesn't force anything on developers.

Ease of Learning

Ease of Learning
5 Stars
Flask is simple and its core features are not difficult to learn. There are also plenty of online resources available to aid in learning.
Ease of Learning
5 Stars
Straightforward and easy to learn. Being around for almost 20 years, it has a good amount of tutorials online.
Database Support

RDBMS Support

RDBMS Support
Through Plugins or Extensions
Through Plugins or Extensions
Flask doesn't come with a built-in ORM framework. Developers can use one of many open source libraries or extensions. Such as Flask-SQLAlchemy, Flask-Pony, etc.
RDBMS Support
Through Plugins or Extensions
Through Plugins or Extensions
No built-in ORM framework. Leaves it up to developers to choose their own such as SQLAlchemy.

NoSQL Support

NoSQL Support
NoSQL databases are supported through open source libraries or extensions. To use MongoDB with Flask, Flask-PyMong is a popular choice. CouchDB, Cassandra, and DynamoDB are also supported via libraries.
Verdict Flask is a great choice if you want to develop for a NoSQL database.
NoSQL Support
No built-in support for NoSQL databases but developers can use libraries to talk to MongoDB, DynamoDB etc.
Web & Core Features

Admin Dashboard

Admin Dashboard
Through Plugins or Extensions
Through Plugins or Extensions
No built-in admin panel, but you can use the Flask-Admin extension. It supports a number of backends like SQLAlchemy, MongoEngine, Peewee etc.
Admin Dashboard
Through Plugins or Extensions
Through Plugins or Extensions
No built-in admin panel.

REST Support

REST Support
Supported via extensions such as Flask-RESTful, Flask-Classful, Flask-RESTPlus.
REST Support
No built-in support but can be implemented easily. Read this guide to implement.

Security

Security
Despite being a minimalist Framework, Flask does an excellent job of addressing common security concerns like CSRF, XSS, JSON security and more out of the box. 3rd party extensions like Flask-Security can be used for common security measures. However, it requires that developers evaluate these extensions carefully for security risks and apply timely updates manually when vulnerabilities are discovered.
Security
No built-in protection. Must be handled by developers themselves or by using 3rd party extensions.

Templating Library

Templating Library
Flask uses Jinja2 out of the box.
Templating Library
Doesn't come with a built-in templating language or package. Developers can use Jinja2, Mako. See full list here

Web Forms

Web Forms
No built-in support but there is Flask-WTF extention. For SQLAlchemy support, that is, to create forms based on models, there is WTForms-Alchemy
Web Forms
No built-in support. Developers can use formencode or any other solution.

Authentication

Authentication
Only provides support for cookie-based sessions but there are extensions available for authentication, authorization and account management.
Authentication
Built-in implementation of HTTP Basic Access Authentication.

Testing

Testing
Built-in support using Python's unittest framework.
Testing
Using WebTest and Nose.

If you found this useful, please help us grow by sharing this article with your followers using the sharing icons. Every share or call out will help. Thank you.

Similar Comparisons

Speak Your Mind