various flask fixes+wsgi app so it can be run via apache2