MCPcopy
hub / github.com/django/django / restart_with_reloader

Function restart_with_reloader

django/utils/autoreload.py:273–292  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

271
272
273def restart_with_reloader():
274 new_environ = {**os.environ, DJANGO_AUTORELOAD_ENV: "true"}
275 orig = getattr(sys, "orig_argv", ())
276 if any(
277 (arg == "-u")
278 or (
279 arg.startswith("-")
280 and not arg.startswith(("--", "-X", "-W"))
281 and len(arg) > 2
282 and arg[1:].isalpha()
283 and "u" in arg
284 )
285 for arg in orig[1:]
286 ):
287 new_environ.setdefault("PYTHONUNBUFFERED", "1")
288 args = get_child_arguments()
289 while True:
290 p = subprocess.run(args, env=new_environ, close_fds=False)
291 if p.returncode != 3:
292 return p.returncode
293
294
295class BaseReloader:

Callers 1

run_with_reloaderFunction · 0.85

Calls 3

get_child_argumentsFunction · 0.85
setdefaultMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected