Skip to content

Flask App Builder Integration

valhuber edited this page Sep 11, 2021 · 7 revisions

See ApiLogicServer

Flask AppBuilder is based on SQLAlchemy, so is naturally integrated with Logic Bank. There are 2 approaches:

  • ApiLogicServer creates an executable, customizable project from your database. It is the most straight-forward approach for use Flask AppBuilder. Please examine it for a working example.

  • You can also integrate Logic Bank into your existing Flask AppBuilder application. The sections below outline some of the key considerations.

Update app module

Alter your examples/nw/basic_web_app/app/__init__.py:

appbuilder = AppBuilder(app, db.session)

if use_rules:  # insert this....
    LogicBank.activate(session=db.session, activator=declare_logic)
Activate Rules

The code above requires several imports. Depending on your project structure, you may need to update Python's search path. This was, in fact, required here, with code like:

sys.path.append(required_path_python_rules)
Fix Search Path

Finally, configure logging:

Configure Logging