The flask manual about Setting Command Options only talks about the command FLASK_RUN_PORT
to set environment variables that can be loaded by Click.
How can i find the other options and use them with the pattern FLASK_COMMAND_OPTION
?
I want to set it to my vscode launch.json.
You can access all available commands by executing in a shell :
flask --help
[...] Commands: db Perform database migrations. run Runs a development server. shell Runs a shell in the app context.
Then if you want to list all available options for a given command like run
:
flask run --help
Options: -h, --host TEXT The interface to bind to. -p, --port INTEGER The port to bind to. --reload / --no-reload Enable or disable the reloader. By default the reloader is active if debug is enabled. --debugger / --no-debugger Enable or disable the debugger. By default the debugger is active if debug is enabled. --eager-loading / --lazy-loader Enable or disable eager loading. By default eager loading is enabled if the reloader is disabled. --with-threads / --without-threads Enable or disable multithreading. --help Show this message and exit.
So you can use them with the pattern like in the doc examples, you just have to concatenate the name and the options with underscores, in ALLCAPS:
export FLASK_RUN_PORT=8000
export FLASK_RUN_HOST=0.0.0.0
You can also define boolean options :
export FLASK_RUN_RELOAD=True
export FLASK_RUN_RELOAD=False
NOTE : flask --help
will list default commands, but if you define your app before executing this help (export FLASK_APP=my_app.py
), you will also get all custom commands.
Commands: db Perform database migrations. deploy run Runs a development server. shell Runs a shell in the app context. test perform tests
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With