Refactor to use app factory pattern
Application factory pattern makes it easier to add tests
Add a .flaskenv so we don't depend on exported env var
Application factory pattern makes it easier to add tests
Add a .flaskenv so we don't depend on exported env var