Contents hide 1) Flask 2.0 Upgradation and Installation 2) Flask 2.0 Updates 2.1) Support async views and error handlers 2.2) Function to load config 2.3) Route decorators for common HTTP API methods 2.4) Better CLI errors 2.5) Enables tab completion 2.6) Caching based on content 2.7) Nested Blueprints 3) Links Flask 2.0 – New Major Version Released. This release will contain some new features such as some shorthand properties for the route, Support async views, callbacks such as error handlers, and better CLI errors. Flask 2.0 Upgradation and Installation Install from PyPI with pip. For example, for Flask: pip install -U Flask Note: Flask 2.0 have dropped all support for Python 2 and 3.5, Now Python 3.6 is the minimum supported version. Flask 2.0 Updates Previously deprecated code has also been removed. Testing tools such as pytest enable showing deprecation warnings automatically and turn them into errors to see early what you may need to change in your project. Note: Over the next few weeks, the ecosystem around the projects will continue to update to improve compatibility as necessary. The team encourages you to use pip-compile and Dependabot to pin and control upgrades to your dependencies to avoid unexpected changes. Support async views and error handlers Support async views and other callbacks such as error handlers, defined with async def. Regular sync views continue to work unchanged. ASGI features such as web sockets are not supported. We will continue exploring how to add more support for async. Function to load config A new Config.from_file function to load config from any file format. Route decorators for common HTTP API methods Add route decorators for common HTTP API methods. For example, @app.post("/login") is a shortcut for @app.route("/login", methods=["POST"]). Better CLI errors Better CLI errors when an app could not be loaded. Running the development server shows errors immediately, they are only deferred on reloads. Enables tab completion The flask shell command enables tab completion like the regular python shell does. Caching based on content While serving static files, browsers will cache based on file content rather than a 12-hour timer. That means changes to static content such as CSS styles will be reflected immediately on reload without needing to clear the cache. Nested Blueprints Blueprints can be nested under the other blueprints, allowing a more layered approach to organizing the application. Links Release Date: May 11, 2021 Release Note: Flask v2.0 get Latest News: https://www.geekstrick.com/news Share this:TwitterFacebookRedditLinkedInWhatsAppPrintTumblr Related