What are the benefits of the App-loading refactoring feature in the latest Django-1.7 release?
The benefits are listed as a bullet here . You can see that not demanding
is just one of the stated benefits of the new approach.
- Applications can run code on startup before Django does anything else by using the ready () method of their configuration.
- Application shortcuts are assigned correctly to models, even if they are defined outside of models.py. You don't need to explicitly set app_label.
- You can omit models.py entirely if your application doesn't have any models.
- Applications can be relabeled with the label attribute for application configurations to work around label conflicts.
- The application name can be configured in the administrator using the verbose_name of the application configurations.
- The administrator automatically calls autodiscover () when Django starts. Hence, you can remove this line from the URLconf.
- Django imports all application configurations and models as soon as it launches through a deterministic and simple process. This should make it easier to diagnose import problems such as import loops.
In addition, various errors related to application loading have been recorded under the rubric of application loading refactoring. For example, at one time some parts of the system looked
front-to-back and others back. The order is now consistent throughout the system.
, it doesn't make sense to use this to refer to applications when there is no need to have models for the application (for example, a reusable application can only have templates, say, or control commands), you had to include an empty
file; you can now exclude it entirely.
source to share