application factory for flask following some conventions of configuration