rduplain/flask-script — pull request #41 by collinwat (2012-08-18 16:56:30+00:00)
Title: Support wsgi applications

Heya,

I was working through a multi-app project and came to a point where I had to implement [application dispaching](http://flask.pocoo.org/docs/patterns/appdispatch/). The solution is to implement wsgi middleware instead of a flask specific solution. Since, flask-script assumes all applications are flask instances, I couldn't use application dispatching with the _runserver_ command.

Here's a patch to the Server command that delegates running an application. The branch is chosen based on whether the app is an instance of Flask. I considered duck-type checking for a callable _run_ method instead but went with the current assumption that it's a flask app.

This is a first pass, so please let me know if you have any feedback or changes.

Thanks!