diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py index 38472526329..9bd2cff066d 100644 --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -610,7 +610,7 @@ def start_django(reloader, main_func, *args, **kwargs): main_func = check_errors(main_func) django_main_thread = threading.Thread(target=main_func, args=args, kwargs=kwargs, name='django-main-thread') - django_main_thread.setDaemon(True) + django_main_thread.daemon = True django_main_thread.start() while not reloader.should_stop: diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py index 3cb901af7d3..a0af1e9fa96 100644 --- a/tests/utils_tests/test_autoreload.py +++ b/tests/utils_tests/test_autoreload.py @@ -364,7 +364,7 @@ class StartDjangoTests(SimpleTestCase): mocked_thread.call_args[1], {'target': fake_main_func, 'args': (123,), 'kwargs': {'abc': 123}, 'name': 'django-main-thread'} ) - self.assertSequenceEqual(fake_thread.setDaemon.call_args[0], [True]) + self.assertIs(fake_thread.daemon, True) self.assertTrue(fake_thread.start.called)