Description

The app registry is explicitly designed to support models outside installed applications.

This doesn't seem particularly useful and makes the code more complicated than necessary.

However, the consequences on backwards compatibility are hairy. If users simply add the missing apps to their INSTALLED_APPS settings, their project could start loading the wrong templates, static files, etc.

While discussing #19774 on IRC it appeared that django.contrib.sites.models.get_current_site() which is imported in various places in Django would end up being an issue to anyone who doesn't have django.contrib.sites installed.

If we want to be ready for Django 1.9, we probably should start a deprecation period in 1.7 to move get_current_site() to the package __init__.py.

It occurs to me that the ideal resolution for this ticket would be one where you could safely import models anytime, but they just wouldn't be available in the app registry or register themselves with the ORM (e.g. attach related managers to other models) until/unless their app were installed. (The general principle being that errors on import, or having to be careful what you import when, is an unfortunate smell due to reliance on import side effects.) I presume you considered this and decided it just wasn't feasible to implement? (I haven't looked at the relevant code in detail recently enough to know.)

Following the app-loading refactor, these objects must live outside of
django.contrib.sites.models because they must be available without
importing the django.contrib.sites.models module when
django.contrib.sites isn't installed.