Fix errors when loading extensions in manage.py.
Review Request #2956 — Created March 11, 2012 and submitted
Fix errors when loading extensions in manage.py. There were some very confusing errors when running manage.py with installed extensions. These would manifest as errors loading a view from reviews.views while trying to resolve a URL for the admin page for an extension. The real problem is that loading reviews.views would load reviews.datagrids, which would use MEDIA_SERIAL, which wasn't defined yet due to how we now initialize Review Board. Previously we'd initialize when loading URLs, but now we initialize through middleware. So to fix this, we now initialize middleware in manage.py prior to loading extensions. This solves the problem and also likely will fix some issues people may hit with management commands.
My previous attempts to run ./reviewboard/manage.py syncdb were failing, but worked after this change. The shell also worked again. runserver continues to work (goes down a different code path), and unit tests all work.