wired behavior after update from 3.2.25 to 4.2.14

after I update from ver 3.2.25 to 4.2.14 I can’t run my server locally with any error.
I found the line of code that ‘’ of the problem

class ApiConfig(AppConfig):
name = “api”

def ready(self):
    from api.scheduler.jobs_init import scheduler_init

    scheduler_init()

import logging
logger = logging.getLogger(“default_logger”)

def scheduler_init():
logger.info(“test”)
###########################
“do some logic”
###########################

when I remove the logger line the server run normally but when I start it with the logger its stop in the meddle:

2024-07-21 07:27:52,253 INFO [jobs_init.py:34] test

2024-07-21 07:27:53,912 INFO [jobs_init.py:34] test
Watching for file changes with StatReloader
Performing system checks…

/Users/test/Desktop/api/response_error_handling.py:30 - This is a test message.

System check identified no issues (0 silenced).

I don’t think the output shows an error from logger.info()—the message prints, and Django completes its system checks. It stops before the usual “Starting development server” message, though, so it’s hard to tell what happens next.

Since the message appears twice, try:

python manage.py runserver --noreload

The autoreloader may be running your startup code more than once. I’d also move the scheduler startup out of ready() and run it in a seperate worker or management command. If it still hangs with --noreload, try keeping the log line but temporarily disabling the rest of scheduler_init().