Flask Web Development Reading notes

Source: Internet
Author: User

The two main dependencies of 1.Flask:

routing, debugging, and Web server gateway interfaces (Web server gateway INTERFACE,WSGI) subsystems are provided by Werkzeug.

The template system is provided by JINJA2.

Werkzeug Features:

HTTP header parsing and encapsulation

Easy-to-use request and response objects

Browser-based interactive JavaScript debugger

Compatible with WSGI 1.0 specification 100%

Support for Python 2.4-python 2.7 (Python 3.0 experimental Support)

Unicode supported

Support for basic session management and signature cookies

Unicode usage tools that support URIs and IRI

Built-in support for various browsers and WSGI server-compatible utilities

Integrated URL Request Routing system

2. The view function processes the request and returns the return value as a response

Request Hook function: Before_first_request

Before_request

After_request

Teardown_request

The context in which the view function and the request hook function can be used:

Program Context: Current_app (program instance)

g (Temporary storage object)

Request Context: Requests (Request object)

Session (user sessions)

3. Separating the business logic from the presentation logic, the presentation logic is implemented using a template, and the template is rendered by the JINJA2 template engine.

4. Use Flask-bootstrap to integrate the bootstrap client framework.

5. Using Flask-moment to localize dates and times

6. Using FLASK-WTF to process Web Forms

7. Using SQL or NoSQL

For small and medium programs, SQL and NoSQL performance are comparable.

Relational database Benefits: storage data is efficient and avoids duplication. Cons: Data exists in more than one table, and data changes may require access to multiple tables and then join.

NoSQL: A document database, a key-value pair database, a collection instead of a table, and a document instead of a record. Pros: Put data into a collection, improve lookup efficiency, and operate simply (without coupling). Cons: Data duplication is large, the need to find related data in the program to perform junction operations, data updates may need to update a large number of documents.

Cond

Flask Web Development Reading notes

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.