1👍
✅
Instead of writing standalone script you should to write django custom command.
Answering your question this behavior is achieved by accessing django.conf.settings
attribute in django.db
module.
Django settings is lazy object. Once any of settings property requested, lazy settings object initialize settings object and perform configuration of logging.
Look at chain of methods in LazySettings:
__getattr__
call_setup
_setup
call_configure_logging
Source:stackexchange.com