New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better exception handling when env vars are missing for flask CLI #2741
Comments
|
Anything that improves help messages is great. |
Looks better in flask 1.0.2, so maybe we can close this?
|
This comment has been minimized.
This comment has been minimized.
The various exception messages, including when the env var wasn't set and a default wasn't found, have improved over time. That one now reads:
Tracebacks were added in #2208 to avoid confusion caused by the previous behavior where After reviewing the code, I think we should show only the error message for |
Expected Behavior
As there is the support for
lazy loading
the app, when runningflask
CLI without providing the proper environment variables we must see a better warning instead of raw exception.Tell us what should happen.
we should see a better warning or message pointing to the problem
Actual Behavior
Tell us what happens instead.
we see traceback before the help message
The same happens to
run
The
Error: Could not import "app".
could includeWARNING: You need to define the app e.g: export FLASK_APP=app.py
Suggestion
We could check the existence of
FLASK_APP
envvar before running any of the commands in the Group Cli, if FLASK_APP does not exist the dispatch of commands never happens.Environment
The text was updated successfully, but these errors were encountered: