smurfix/flask-script

Error when the app is a "combined app" using werkzeug's wsgi.DispatcherMiddleware

Closed this issue · 2 comments

371c commented

Hi,

This is may not be a "real bug" but I'm getting the following error when i create the Manager object with a "combined app" - created using werkzeug's DispatcherMiddleware

 // ie. app =  wsgi.DispatcherMiddleware(app1, {'/app2': app2})
 manager = Manager(app) 

File "../venv/lib/python2.7/site-packages/flask_script/__init__.py", line 366, in run
raise e
TypeError: __call__() takes exactly 3 arguments (1 given)

Again, this may be by design or something i haven't understood.

Thanks in advance,

The exception is caught and reraised so it's hiding the exact exception, but ultimately the problem is becauseapp in your example is just a WSGI app/instance and not a Flask app/instance. I think the line throwing the exception would be when the app is attempted to be created thinking it was an app factory since it's not an instance of Flask.
https://github.com/techniq/flask-script/blob/v0.6.2/flask_script/__init__.py#L135

I don't think there is a way to fix this since Flask-Script has a reliance on Flask (more than just WSGI). In your example you could initialize Manager on app1 instead of the DispatcherMiddleware app

371c commented

Fair enough, initializing Manager on app1, for example, is what i was doing. Thanks for replying.