本文整理匯總了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