`app` parameter looks optional, but there is no conditional around it before calling `.config`. I think that `app` is a must, thus I would replace that `app=None` by `app` and make it a must.