本文整理汇总了Python中flask.app.Flask.config['SQLALCHEMY_TRACK_MODIFICATIONS']方法的典型用法代码示例。如果您正苦于以下问题:Python Flask.config['SQLALCHEMY_TRACK_MODIFICATIONS']方法的具体用法?Python Flask.config['SQLALCHEMY_TRACK_MODIFICATIONS']怎么用?Python Flask.config['SQLALCHEMY_TRACK_MODIFICATIONS']使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flask.app.Flask
的用法示例。
在下文中一共展示了Flask.config['SQLALCHEMY_TRACK_MODIFICATIONS']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_app
# 需要导入模块: from flask.app import Flask [as 别名]
# 或者: from flask.app.Flask import config['SQLALCHEMY_TRACK_MODIFICATIONS'] [as 别名]
def build_app():
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
db = SQLAlchemy(app)
app.secret_key = 'super secret key'
admin = Admin(app, name='Fuzz', template_mode='bootstrap3')
admin.add_view(ModelView(FuzzerIssue, db.session))
logging.basicConfig(level=logging.DEBUG)
return app
示例2: __new__
# 需要导入模块: from flask.app import Flask [as 别名]
# 或者: from flask.app.Flask import config['SQLALCHEMY_TRACK_MODIFICATIONS'] [as 别名]
def __new__(cls, *args, **kwargs):
if cls._instance is None:
app = Flask(__name__)
app.register_blueprint(PeopleBluePrintFactory.create())
flask_injector = FlaskInjector(
app=app,
modules=[DatabaseModule(), ],
)
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/production.db'
db.init_app(app)
with app.app_context():
db.create_all()
cls._instance = flask_injector
return cls._instance