Skip to content
Myr

Merge pull request #2707 from rochacbruno/lazy_loader_message

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Add a message `Serving Flask app (module "app.py" will be lazily loaded)` to `flask run` related to #2706

authored by David Lord · committed by GitHub · parents be46acb, 80a9e0e · Browse files · 2 files+11 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+11 added−6 removed

  • other:+11 added−6 removed

2 files+11 added−6 removed

modified:flask/app.py+1 added-1 removed
931 unmodified lines
932 options.setdefault('use_reloader', self.debug)933 options.setdefault('use_debugger', self.debug)934 options.setdefault('threaded', True)935936 cli.show_server_banner(self.env, self.debug, self.name)936 cli.show_server_banner(self.env, self.debug, self.name, False)937938 from werkzeug.serving import run_simple939940 try:
1367 unmodified lines
modified:flask/cli.py+10 added-5 removed
612 unmodified lines
613614 return new_dir is not None # at least one file was located and loaded615616617def show_server_banner(env, debug, app_import_path):617def show_server_banner(env, debug, app_import_path, eager_loading):618 """Show extra startup messages the first time the server is run,619 ignoring the reloader.620 """621 if os.environ.get('WERKZEUG_RUN_MAIN') == 'true':622 return623624 if app_import_path is not None:625 print(' * Serving Flask app "{0}"'.format(app_import_path))625 message = ' * Serving Flask app "{0}"'.format(app_import_path)626627 print(' * Environment: {0}'.format(env))627 if not eager_loading:628 message += ' (lazy loading)'629630 click.echo(message)631632 click.echo(' * Environment: {0}'.format(env))633634 if env == 'production':635 click.secho(636 ' WARNING: Do not use the development server in a production'637 ' environment.', fg='red')638 click.secho(' Use a production WSGI server instead.', dim=True)639640 if debug is not None:636 print(' * Debug mode: {0}'.format('on' if debug else 'off'))641 click.echo(' * Debug mode: {0}'.format('on' if debug else 'off'))642643644class CertParamType(click.ParamType):645 """Click option type for the ``--cert`` option. Allows either an
117 unmodified lines
763764 if eager_loading is None:765 eager_loading = not reload766762 show_server_banner(get_env(), debug, info.app_import_path)767 show_server_banner(get_env(), debug, info.app_import_path, eager_loading)768 app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)769770 from werkzeug.serving import run_simple771 run_simple(host, port, app, use_reloader=reload, use_debugger=debugger,
124 unmodified lines