Flask Documentation (1.1.x)
Extensions Deploying to a Web Server Tutorial Project Layout Application Setup Define and Access the Database Blueprints and Views Templates Static Files Blog Blueprint Make the Project Installable Test Coverage aims to keep the core simple but extensible. Flask won’t make many decisions for you, such as what database to use. Those decisions that it does make, such as what templating engine to use, are easy to change that Flask can be everything you need and nothing you don’t. By default, Flask does not include a database abstraction layer, form validation or anything else where different libraries already exist that0 码力 | 428 页 | 895.98 KB | 1 年前3Flask Documentation (1.1.x)
aims to keep the core simple but extensible. Flask won’t make many decisions for you, such as what database to use. Those decisions that it does make, such as what templating engine to use, are easy to change that Flask can be everything you need and nothing you don’t. By default, Flask does not include a database abstraction layer, form validation or anything else where different libraries already exist that functionality to your appli- cation as if it was implemented in Flask itself. Numerous extensions provide database integration, form validation, upload handling, various open authentication technologies, and more0 码力 | 291 页 | 1.25 MB | 1 年前3Flask入门教程
字典。配置变量的名称必须使用大写,写入配置的语句一般 会放到扩展类实例化语句之前。 下面写入了一个 SQLALCHEMY_DATABASE_URI 变量来告诉 SQLAlchemy 数据库连 接地址: import os # ... app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////' + os.path. join(app.root_path, 'sqlite:///' else: # 否则使用四个斜线 prefix = 'sqlite:////' app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = prefix + os.path.join(ap p.root_path, 'data.db') app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] def initdb(drop): """Initialize the database.""" if drop: # 判断是否输入了选项 db.drop_all() db.create_all() click.echo('Initialized database.') # 输出提示信息 默认情况下,函数名称就是命令的名字,现在执行 flask0 码力 | 127 页 | 7.62 MB | 1 年前3Flask-RESTful Documentation Release 0.3.10
db_get_todo() # Some function that queries the db This example assumes that you have a custom database object (todo) that has attributes name, address, and date_updated. Any additional attributes on0 码力 | 42 页 | 84.60 KB | 1 年前3Flask-RESTful Documentation Release 0.3.10
return db_get_todo() # Some function that queries the db This example assumes that you have a custom database object (todo) that has attributes name, address, and date_updated. Any additional attributes on0 码力 | 39 页 | 212.29 KB | 1 年前3Flask-RESTful Documentation Release 0.3.6
return db_get_todo() # Some function that queries the db This example assumes that you have a custom database object (todo) that has attributes name, address, and date_updated. Any additional attributes on0 码力 | 46 页 | 245.60 KB | 1 年前3Flask-RESTful Documentation Release 0.3.6
db_get_todo() # Some function that queries the db This example assumes that you have a custom database object (todo) that has attributes name, address, and date_updated. Any additional attributes on0 码力 | 49 页 | 91.90 KB | 1 年前3Flask-RESTful Documentation Release 0.3.7
return db_get_todo() # Some function that queries the db This example assumes that you have a custom database object (todo) that has attributes name, address, and date_updated. Any additional attributes on0 码力 | 50 页 | 253.09 KB | 1 年前3Flask-RESTful Documentation Release 0.3.8
return db_get_todo() # Some function that queries the db This example assumes that you have a custom database object (todo) that has attributes name, address, and date_updated. Any additional attributes on0 码力 | 50 页 | 253.64 KB | 1 年前3Flask-RESTful Documentation Release 0.3.8
db_get_todo() # Some function that queries the db This example assumes that you have a custom database object (todo) that has attributes name, address, and date_updated. Any additional attributes on0 码力 | 55 页 | 93.30 KB | 1 年前3
共 11 条
- 1
- 2