Flask 1.1 Released

Posted by David Lord on 2019-07-04

The Pallets team is pleased to release Flask 1.1. The latest version is 1.1.1. Version 1.0.4 was also released.

Read the changelog for the full list of changes. Be sure to check the notes for the 1.0.x versions as well.

Change to Error Handling

Prior to 1.0, unhandled errors caused a generic InternalServerError to be returned, but only the handler for 500 was looked up for that, and the original error was passed to it. 1.0 made 500 an alias for InternalServerError, but these inconsistencies caused confusion over what errors were passed to what handlers.

As of 1.1, an error handler registered for InternalServerError or 500 means the same thing in all cases. It will always be passed an instance of InternalServerError, even if it was caused by an unhandled error of another type. The original error is available as e.original_exception.

If your project uses a 500 error handler that expects any exception to be passed to it, it should use e.original_exception instead of e.

Change to Logging

In 1.0, Flask's logging setup was greatly simplified. Part of that was hard-coding the name "flask.app" for the logger. However, that made it less clear whether Flask or the app was doing the logging, and made it impossible to distinguish between multiple apps in logs.

As of 1.1, app.logger again takes the same name as app.name. Flask will warn you if it detects logging configuration for "flask" or "flask.app" so you can rename that configuration appropriately.

For example, if your project is named example.py and you initialize your Flask app as Flask(__name__), then the logger will be named "example".

Install or Upgrade

Install from PyPI with pip:

pip install -U Flask

Pallets now accepts donations through the PSF in order to support our efforts to maintain the projects and grow the community. We greatly appreciate any support you can provide. Click here to donate.