Why is django's settings object a LazyObject?
问题 Looking in django.conf I noticed that settings are implemented like this: class LazySettings(LazyObject): ... What is the rationale behind making settings objects lazy? 回答1: Check out this section of the Django coding style. The reason is explained in there (quoted below). In addition to performance, third-party modules can modify settings when they are imported. Accessing settings should be delayed to ensure this configuration happens first. Modules should not in general use settings stored