Removed the app_config.installed flag.

Since applications that aren't installed don't have an application
configuration, it would always be true in practice.

Provided an abstraction to temporarily add or remove applications as
several tests messed with app_config.installed to achieve this effect.
For now this API is _-prefixed because it looks dangerous.
Implemented two-stage app-cache population.

First stage imports app modules. It doesn't catch import errors. This
matches the previous behavior and keeps the code simple.

Second stage import models modules. It catches import errors and retries
them after walking through the entire list once. This matches the
previous behavior and seems useful.

populate_models() is intended to be equivalent to populate(). It isn't
wired yet. That is coming in the next commit.
Terminated AppCache._populate() with extreme prejudice.

It was called _populate() before I renamed it to populate(). Since it
has been superseded by populate_models() there's no reason to keep it.

Removed the can_postpone argument of loap_app() as it was only used by
populate(). It's a private API and there's no replacement. Simplified
load_app() accordingly. Then new version behaves exactly like the old
one even though it's much shorter.
Added an _-prefix to pending lookups because it's transient.
Deprecated load_app().

Adjusted several tests that used it to add apps to the app cache and
then attempted to remove them by manipulating attributes directly.

Also renamed invalid_models to invalid_models_tests to avoid clashing
application labels between the outer and the inner invalid_models
applications.
Populated models only when necessary in get_app_config[s].

Took this opportunity to change get_app[s] to only consider applications
containing a model module as that seems slightly more backwards compatible.

Since callers that care about models pass only_with_models_module=True,
this has very few consequences. Only AppCommand needed a change.
Not all Python modules have a __path__.
Stopped iterating on INSTALLED_APPS.

Used the app cache's get_app_configs() method instead.
Renamed registered_model to has_model.

This avoids possible confusion with register_model.

Thanks Marc Tamlyn for the suggestion.
Stop testing for inclusion in INSTALLED_APPS.

Removed some exception masking in the comments app that was harmful and
couldn't be preserved easily.
Expurged INSTALLED_APPS from code and tests.

Except the app cache code and a few specific tests, of course.