I created two flask apps: frontend and restapi (with flask-restful). I created the following runserver.py to run them in development:
from werkzeug.wsgi import DispatcherMiddleware
from werkzeug.serving import run_simple
from restapi import app as restapi_app
from frontend import app as frontend_app
application = DispatcherMiddleware(frontend_app, {
'/api': restapi_app,
})
if __name__ == "__main__":
run_simple(
'localhost',
5000,
application,
use_reloader=True,
use_debugger=True,
use_evalex=True)
Despite having use_debugger=True, whenever one of the flask-restful resources raises an error, I don't get a trace, just a 500 error
{"status": 500, "message": "Internal Server Error"}
Any ideas how to get the full trace to display? Let me know if you need more details/code.
use_debugger
option of Werkzeug WSGI server only enables embedded debugger, the server is unaware of Flask app configuration values (DEBUG
in this case). To propagate exceptions to the server, you need to enable debug mode for both Flask app objects yourself. Here's one way to do it:
if __name__ == '__main__':
restapi_app.debug = True
frontend_app.debug = True
run_simple(...)