Remove unused imports and add one needed one

Ran through the codebase with pyflakes. It caught one missing
ImproperlyConfigured import.