We need to select a Python web framework for our new analytics application. Key criteria:
- Easy to use and get started
- Good performance
- Flexible and modular
- Built-in caching support
The application will have multiple APIs serving data dashboards and reports. Caching is important to optimize response times for repeated requests.
- Flask - A lightweight framework with few dependencies. Easy to get started and very customizable.
- FastAPI - A modern web framework focused on performance and OpenAPI docs. Asynchronous.
- Django - A full-featured framework. Includes ORM, admin interface, etc out of the box.
We will use Flask as our web framework.
While Django leads in features, it is more complex than we need for this app. FastAPI is very compelling for its performance and docs, but lacks caching support.
Flask provides a simple, flexible core we can build on precisely for our use case. It has robust caching support through plugins like Flask-Caching. We can add plugins for ORM, docs, etc as needed.
- Engineers will need to learn Flask.
- We will implement Flask-Caching for route and data caching.
- We may need to integrate ORM separately using Flask-SQLAlchemy or directly using SQLAlchemy.
- ADR-005: Use Redis for caching
In summary, Flask meets our needs for an easy to use, flexible and customizable web framework with excellent caching support through plugins.