Import applications and returns an app config for the given label. Raise LookupError if no application exists with this label.
(self, app_label)
| 148 | return self.app_configs.values() |
| 149 | |
| 150 | def get_app_config(self, app_label): |
| 151 | """ |
| 152 | Import applications and returns an app config for the given label. |
| 153 | |
| 154 | Raise LookupError if no application exists with this label. |
| 155 | """ |
| 156 | self.check_apps_ready() |
| 157 | try: |
| 158 | return self.app_configs[app_label] |
| 159 | except KeyError: |
| 160 | message = "No installed app with label '%s'." % app_label |
| 161 | for app_config in self.get_app_configs(): |
| 162 | if app_config.name == app_label: |
| 163 | message += " Did you mean '%s'?" % app_config.label |
| 164 | break |
| 165 | raise LookupError(message) |
| 166 | |
| 167 | # This method is performance-critical at least for Django's test suite. |
| 168 | @functools.cache |