An ImproperlyConfigured exception will be raised they mismatch. Backport of 1c58caba and a2cd0e12 from master