- Flask Framework Cookbook(Second Edition)
- Shalabh Aggarwal
- 212字
- 2021-06-24 13:57:54
Conventions used
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "In Flask, a configuration is done on an attribute named config of the Flask object."
A block of code is set as follows:
from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello to the World of Flask!' if __name__ == '__main__': app.run()
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
from flask_wtf.file import FileField, FileRequired class Product(db.Model): image_path = db.Column(db.String(255)) def __init__(self, name, price, category, image_path): self.image_path = image_path class ProductForm(NameForm): image = FileField('Product Image', validators=[FileRequired()])
Any command-line input or output is written as follows:
$ pip3 install Flask
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "It can also handle the Remember me feature, account recovery features, and so on."