Home » Support » Index of All Documentation » How-Tos » How-Tos for Web Development »

Using Wing IDE with Flask

Wing IDE is an integrated development environment that can be used to write, test, and debug Python code that is written for Flask. Wing provides auto-completion, call tips, a powerful debugger, and many other features that help you write, navigate, and understand Python code.

For more information on Wing IDE see the product overview. If you do not already have Wing IDE installed, download a free trial now. To get started using Wing, refer to the tutorial in the Help menu in Wing and/or the Wing IDE Quickstart Guide.

Debugging in Wing IDE

To debug Flask in Wing you need to turn off Flask's built-in debugger, so that Wing's debugger can take over in reporting exceptions.

To do this, you can set up your main entry point as in the following example:

from flask import Flask
app = Flask(__name__)


if __name__ == "__main__":
    from os import environ
    if 'WINGDB_ACTIVE' in environ:
        app.debug = False

Notice that this turns off Flask's debugging support only if Wing IDE's debugger is present.

The use_reloader argument is optional, but speeds up debugging considerably because Flask won't need a restart to load code changes. If this option is set to True you will need to enable Debug Child Processes under the Debug/Execute tab in Project Properties from the Project menu. Otherwise the reloaded process will not be debugged. This option is only available under Wing IDE Professional; app.run() should be used with Wing IDE Personal.

Once this is done, use Set Main Debug File in the Debug menu to set this file as your main debug file in Wing IDE. Then you can start debugging from the IDE, and load pages from a browser to reach breakpoints or exceptions.

If you did not set the use_reloader argument to app.run() to True then you will need to use Restart Debugging in the Debug menu or the restart icon in the toolbar to load changed code into Flask.

Passing the --no-debug flag or setting environment variable FLASK_DEBUG=0 are other documented ways to turn of Flask's debug support, although we've had reports of --no-debug failing to function as expected.

Related Documents

Wing IDE provides many other options and tools. For more information:

Using Wing IDE with Flask