Begin porting to flask in hope that it fixes previous issues

This should have been done in a different branch. Oh well. This isn't an
important project anyway...