After eight years of sharpening a sword, the Python web framework Flask 1.0 was officially released

  

Flask 1.0 has been officially released, Flask is a tiny web framework developed in Python, originally built in 2010 and has been developed for 8 years.

Sample code:

from flask import Flask
app = Flask(__name__)@app.route("/")def hello():
    return "Hello World!"if __name__ == "__main__":
    app.run()

Update highlights:

  • Python 2.6 and 3.3 are no longer supported.

  • CLI is more flexible. 

  • If python-dotenv is installed, flask CLI will load environment variables from .flaskenv and .env files without having to export them in every new terminal.

  • The development server multithreads by default to handle concurrent requests during development.

  • The previously deprecated flask.ext has been completely removed.

  • A more useful error notification is displayed when accessing the missing key of request.form in debug mode to avoid confusion for developers with common sources of errors. 

  • The behavior of app.logger has been greatly simplified and easier to customize.

  • The test_client adds a json parameter for publishing JSON data, and the Response object adds a get_json method to decode the data to JSON in the test.

  • Added test_cli_runner, a CLI command for testing applications.

  • A lot of documentation has been rewritten for clarity. This is a long-term ongoing job.

  • The tutorial and corresponding examples have been rewritten. The new examples use a structured layout and detail each aspect to help new users better avoid common problems and get used to Flask.

See the release notes for details:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324932629&siteId=291194637