MCPcopy Create free account
hub / github.com/pallets/quart / load_app

Method load_app

src/quart/cli.py:245–276  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

243 self._loaded_app: Quart | None = None
244
245 def load_app(self) -> Quart:
246 if self._loaded_app is not None:
247 return self._loaded_app
248
249 if self.create_app is not None:
250 app = self.create_app()
251 else:
252 if self.app_import_path:
253 path, name = (
254 re.split(r":(?![\\/])", self.app_import_path, maxsplit=1) + [None]
255 )[:2]
256 import_name = prepare_import(path)
257 app = locate_app(import_name, name)
258 else:
259 import_name = prepare_import("app.py")
260 app = locate_app(import_name, None)
261
262 if not app:
263 raise NoAppException(
264 "Could not locate a Quart application. Use the"
265 " 'quart --app' option, 'QUART_APP' environment"
266 " variable, or an 'app.py' file in the"
267 " current directory."
268 )
269
270 if self.set_debug_flag:
271 # Update the app's debug flag through the descriptor so that
272 # other values repopulate as well.
273 app.debug = get_debug_flag()
274
275 self._loaded_app = app
276 return app
277
278
279pass_script_info = click.make_pass_decorator(ScriptInfo, ensure=True)

Callers 5

_innerFunction · 0.80
get_commandMethod · 0.80
list_commandsMethod · 0.80
run_commandFunction · 0.80

Calls 4

prepare_importFunction · 0.85
locate_appFunction · 0.85
NoAppExceptionClass · 0.85
get_debug_flagFunction · 0.85

Tested by 1