Base Configuration¶
Configuration keys¶
Use config.py to configure the following parameters. By default it will use SQLLITE DB, and bootstrap’s default theme:
Using config.py¶
My favorite way, and the one I advise if you are building a medium to large size application is to place all your configuration keys on a config.py file
Next you only have to import them to the Flask app object, like this
app = Flask(__name__)
app.config.from_object('config')
Take a look at the skeleton config.py
Using JMESPath to map user registration role¶
If user self registration is enabled and AUTH_USER_REGISTRATION_ROLE_JMESPATH
is set, it is
used as a JMESPath expression to evalate user registration role. The input
values is userinfo
dict, returned by get_oauth_user_info
function of Security Manager.
Usage of JMESPath expressions requires jmespath package
to be installed.
In case of Google OAuth, userinfo contains user’s email that can be used to map some users as admins
and rest of the domain users as read only users. For example, this expression:
contains(['user1@domain.com', 'user2@domain.com'], email) && 'Admin' || 'Viewer'
causes users 1 and 2 to be registered with role Admin
and rest with the role Viewer
.
JMESPath expression allow more groups to be evaluated:
email == 'user1@domain.com' && 'Admin' || (email == 'user2@domain.com' && 'Op' || 'Viewer')
For more example, see specification.