I\'m attempting to upgrade quite a large Django project to the newly released Django 1.4, and I\'m having some issues when running python manage.py test.
Short Answer: You have a copy of Django admin template files copied in on of your app's templates directory from an earlier version of Django, then you upgraded Django but didn't update (re-copy) those local templates.
Long Answer: The main cause of this problem is using an older version of Django admin template files (which are installed where django itself is installed, usually python's site-packages or dist-packages directory). There is a backward incompatible change in Django 1.5 about url template tag, in which the first parameter must be a string, from Django 1.5 release notes:
One deprecated feature worth noting is the shift to “new-style” url tag. Prior to Django 1.3, syntax like {% url myview %} was interpreted incorrectly (Django considered "myview" to be a literal name of a view, not a template variable named myview). Django 1.3 and above introduced the {% load url from future %} syntax to bring in the corrected behavior where myview was seen as a variable.
So, the problem is you have a copy of admin's template files in one of your app's templates folder, which is coppied from an earlier version of Django. This is usually done for overriding default admin templates. Because of the backward incompatible change noted, these outdated template file can not load in a newer Django environment, and cause the strange error: NoReverseMatch: u'admin' is not a registered namespace.
Changing order of TEMPLATE_LOADERS entries will ignore the local admin templates modifications in favor of default templates file (because default Django templates are loaded by complete path with filesystem.Loader). If the modifications are needed (which is usually the case), you must update your local admin template files from your new Django installation templates and reapply your modifications on them.
Note 1: A similar situation is when local admin templates are newer than Django installation's default, which seems this is your case. Similarly, the better fix is to update all copies of admin templates.
Note 2: Another possibility of getting such error is when using virtualenv. For example, if you are running your project with a virtualenv but the TEMPLATE_DIRS entry for Django admin templates is to your global python installation, you may get this error.