diff --git a/django/apps/base.py b/django/apps/base.py index 4102780560..40b72c9448 100644 --- a/django/apps/base.py +++ b/django/apps/base.py @@ -83,13 +83,13 @@ class AppConfig(object): # would raise when exists but not , with # more context (Python just says "cannot import name ..."). raise ImportError( - "cannot import name %r from %r" % (cls_name, mod_path)) + "cannot import name '%s' from '%s'" % (cls_name, mod_path)) # Check for obvious errors. (This check prevents duck typing, but # it could be removed if it became a problem in practice.) if not issubclass(cls, AppConfig): raise ImproperlyConfigured( - "%r isn't a subclass of AppConfig." % entry) + "'%s' isn't a subclass of AppConfig." % entry) # Obtain app name here rather than in AppClass.__init__ to keep # all error checking for entries in INSTALLED_APPS in one place. @@ -97,7 +97,7 @@ class AppConfig(object): app_name = cls.name except AttributeError: raise ImproperlyConfigured( - "%r must supply a name attribute." % entry) + "'%s' must supply a name attribute." % entry) # Ensure app_names points to a valid module. app_module = import_module(app_name) diff --git a/django/apps/registry.py b/django/apps/registry.py index 737fc960b8..8a25bad281 100644 --- a/django/apps/registry.py +++ b/django/apps/registry.py @@ -181,9 +181,9 @@ class Apps(object): app_config = self.app_configs.get(app_label) if app_config is None: - raise LookupError("No installed app with label %r." % app_label) + raise LookupError("No installed app with label '%s'." % app_label) if only_with_models_module and app_config.models_module is None: - raise LookupError("App with label %r doesn't have a models module." % app_label) + raise LookupError("App with label '%s' doesn't have a models module." % app_label) return app_config # This method is performance-critical at least for Django's test suite.