Flask 1.0 update

This is pending Flask 1.0 release and shouldn't be merged yet. On Flask 1.0 and click release the setup.py will have to be updated. Most of the port work is done though and the docs have been updated.

Since directory is a required option for everything, it might be worth moving it one level up, but that would break existing command lines.