Skip to content

FLASK_APP is unavailable when FlaskGroup is not used #5156

Answered by davidism
TitaniumHocker asked this question in Q&A
Discussion options

You must be logged in to vote

You still need to run commands with the flask command, that's why you register them with app.cli.add_command.

$ flask main test

If you really want to use only your group and not the flask command, then you need to create the ScriptInfo object like FlaskGroup would have done for you.

if __name__ == "__main__":
    info = ScriptInfo(create_app=create_app)
    cli(obj=info)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by davidism
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #5155 on June 07, 2023 16:11.