You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Timo (JIRA)" <ji...@apache.org> on 2017/11/14 14:44:00 UTC

[jira] [Comment Edited] (AIRFLOW-98) Using Flask extensions from a plugin

    [ https://issues.apache.org/jira/browse/AIRFLOW-98?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16251470#comment-16251470 ] 

Timo edited comment on AIRFLOW-98 at 11/14/17 2:43 PM:
-------------------------------------------------------

This functionality is not only useful for enabling more extensions, but also so we can register extra jinja filters and use the Flask app decorators.

If the order of execution (plugins first, then the Flask app) isn't easy to change, would it possible to have an optional {{init_app(app)}} function in the plugin file or plugin class? Something like being done for [{{login_manager}}|https://github.com/apache/incubator-airflow/blob/d4d8eb932657f4d1eccfaa8bb1d12933535fae94/airflow/www/app.py#L46] or [{{api_auth}}|https://github.com/apache/incubator-airflow/blob/d4d8eb932657f4d1eccfaa8bb1d12933535fae94/airflow/www/app.py#L50]


was (Author: timovwb):
This functionality is not only useful for enabling more extensions, but also so we can register extra jinja filters and use the Flask app decorators.

If the order of execution (plugins first, then the Flask app) isn't easy to change, would it possible to have an optional `init_app(app)` function in the plugin file or plugin class? Something like being done for [`login_manager`|https://github.com/apache/incubator-airflow/blob/d4d8eb932657f4d1eccfaa8bb1d12933535fae94/airflow/www/app.py#L46] or [`api_auth`|https://github.com/apache/incubator-airflow/blob/d4d8eb932657f4d1eccfaa8bb1d12933535fae94/airflow/www/app.py#L50]

> Using Flask extensions from a plugin
> ------------------------------------
>
>                 Key: AIRFLOW-98
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-98
>             Project: Apache Airflow
>          Issue Type: Bug
>            Reporter: Timo
>
> I am creating a plugin which should be able to use some Flask extensions. Is there any way to do this?
> Basically I need to import the airflow.www.app.app object in the plugin to initialise the extension with.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)