Bug fixes

Do you really need `traceback` and `print_exc`?
```python
app.logger.exception("could not import %s.%s", package, name)
```
If you move up a bit the `if app is None` from line 35, you won't need that `if`.