Python16_day38 "Flask"

Source: Internet
Author: User

First, Introduction

Flask is a mini-framework developed based on Python and relies on jinja2 templates and Werkzeug Wsgi services, for the Werkzeug essence is the socket server, which is used to receive HTTP requests and preprocess requests, and then trigger the flask framework. Based on the functionality provided by the Flask framework, the developer processes the request and returns it to the user, and if it is to be returned to the user complex content, it is necessary to use the JINJA2 template to do the processing of the template, namely: render the template and data and return the rendered string to the user's browser.

Micro does not mean that you need to cram the entire WEB application into a single Python file (though it does), and does not imply that the Flask is functionally deficient. Micro-frame "micro" means that Flask is designed to keep the core simple and easy to scale. Flask won't make too many decisions for you--like what kind of database to use. And what Flask chooses--like what template engine to use--is easy to replace. Everything else can be mastered by you. This way, Flask can be a perfect match for you.

By default, Flask does not include the database abstraction layer, form validation, or any other functionality that already has multiple libraries to perform. However, Flask supports the use of extensions to add these features to your app, just as the Flask itself implements. Numerous extensions provide features such as database integration, form validation, upload processing, and a wide variety of open authentication technologies. Flask may be "tiny", but it is ready to be put into use in a demanding production environment.

PIP3 Install Flaskfrom werkzeug.wrappers import request, Response@request.applicationdef hello (Request):    return Response (' Hello world! ') if __name__ = = ' __main__ ': from    werkzeug.serving import run_simple    run_simple (' localhost ', 4000, hello)

Python16_day38 "Flask"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.