made some minor changes in cli.py
This commit is contained in:
parent
94de1326f2
commit
c63bee037f
1 changed files with 17 additions and 17 deletions
|
|
@ -76,9 +76,9 @@ def find_best_app(module):
|
||||||
) from e
|
) from e
|
||||||
|
|
||||||
raise NoAppException(
|
raise NoAppException(
|
||||||
"Failed to find Flask application or factory in module"
|
f"""Failed to find Flask application or factory in module
|
||||||
f" '{module.__name__}'. Use '{module.__name__}:name'"
|
'{module.__name__}'. Use '{module.__name__}:name'
|
||||||
" to specify one."
|
to specify one."""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -168,9 +168,9 @@ def find_app_by_string(module, app_name):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
raise NoAppException(
|
raise NoAppException(
|
||||||
f"The factory {app_name!r} in module"
|
f"""The factory {app_name!r} in module
|
||||||
f" {module.__name__!r} could not be called with the"
|
{module.__name__!r} could not be called with the
|
||||||
" specified arguments."
|
specified arguments."""
|
||||||
) from e
|
) from e
|
||||||
else:
|
else:
|
||||||
app = attr
|
app = attr
|
||||||
|
|
@ -179,8 +179,8 @@ def find_app_by_string(module, app_name):
|
||||||
return app
|
return app
|
||||||
|
|
||||||
raise NoAppException(
|
raise NoAppException(
|
||||||
"A valid Flask application was not obtained from"
|
f"""A valid Flask application was not obtained from
|
||||||
f" '{module.__name__}:{app_name}'."
|
'{module.__name__}:{app_name}'."""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -221,8 +221,8 @@ def locate_app(module_name, app_name, raise_if_not_found=True):
|
||||||
# Determine this by checking whether the trace has a depth > 1.
|
# Determine this by checking whether the trace has a depth > 1.
|
||||||
if sys.exc_info()[2].tb_next:
|
if sys.exc_info()[2].tb_next:
|
||||||
raise NoAppException(
|
raise NoAppException(
|
||||||
f"While importing {module_name!r}, an ImportError was"
|
f"""While importing {module_name!r}, an ImportError was
|
||||||
f" raised:\n\n{traceback.format_exc()}"
|
raised:\n\n{traceback.format_exc()}"""
|
||||||
) from None
|
) from None
|
||||||
elif raise_if_not_found:
|
elif raise_if_not_found:
|
||||||
raise NoAppException(f"Could not import {module_name!r}.") from None
|
raise NoAppException(f"Could not import {module_name!r}.") from None
|
||||||
|
|
@ -245,9 +245,9 @@ def get_version(ctx, param, value):
|
||||||
from . import __version__
|
from . import __version__
|
||||||
|
|
||||||
click.echo(
|
click.echo(
|
||||||
f"Python {platform.python_version()}\n"
|
f"""Python {platform.python_version()}\n
|
||||||
f"Flask {__version__}\n"
|
Flask {__version__}\n
|
||||||
f"Werkzeug {werkzeug.__version__}",
|
Werkzeug {werkzeug.__version__}""",
|
||||||
color=ctx.color,
|
color=ctx.color,
|
||||||
)
|
)
|
||||||
ctx.exit()
|
ctx.exit()
|
||||||
|
|
@ -316,10 +316,10 @@ class ScriptInfo:
|
||||||
|
|
||||||
if not app:
|
if not app:
|
||||||
raise NoAppException(
|
raise NoAppException(
|
||||||
"Could not locate a Flask application. Use the"
|
"""Could not locate a Flask application. Use the
|
||||||
" 'flask --app' option, 'FLASK_APP' environment"
|
'flask --app' option, 'FLASK_APP' environment
|
||||||
" variable, or a 'wsgi.py' or 'app.py' file in the"
|
variable, or a 'wsgi.py' or 'app.py' file in the
|
||||||
" current directory."
|
current directory."""
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.set_debug_flag:
|
if self.set_debug_flag:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue