Flask SQLAlchemy 脚本测试方法 发表于 2017-09-22 | 分类于 编程 | app / db上下文 环境中测试脚本123456789from flask import Flaskfrom flask_sqlalchemy import SQLAlchemyapp = Flask(__name__)with app.app_context(): app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///~/work/TowerMonitor/TMService/db/global.db' db = SQLAlchemy(app) if __name__ == '__main__':