MCPcopy
hub / github.com/django/django / wait_for_apps_ready

Method wait_for_apps_ready

django/utils/autoreload.py:327–343  ·  view source on GitHub ↗

Wait until Django reports that the apps have been loaded. If the given thread has terminated before the apps are ready, then a SyntaxError or other non-recoverable error has been raised. In that case, stop waiting for the apps_ready event and continue processing.

(self, app_reg, django_main_thread)

Source from the content-addressed store, hash-verified

325 yield from directory.glob(pattern)
326
327 def wait_for_apps_ready(self, app_reg, django_main_thread):
328 """
329 Wait until Django reports that the apps have been loaded. If the given
330 thread has terminated before the apps are ready, then a SyntaxError or
331 other non-recoverable error has been raised. In that case, stop waiting
332 for the apps_ready event and continue processing.
333
334 Return True if the thread is alive and the ready event has been
335 triggered, or False if the thread is terminated while waiting for the
336 event.
337 """
338 while django_main_thread.is_alive():
339 if app_reg.ready_event.wait(timeout=0.1):
340 return True
341 else:
342 logger.debug("Main Django thread has terminated before apps are ready.")
343 return False
344
345 def run(self, django_main_thread):
346 global _url_module_exception

Calls 1

debugMethod · 0.45