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