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

Using Wing with Flask


Wing is a Python IDE that can be used to develop, test, and debug Python code written for the Flask web development framework. Two versions of Wing are available: Wing Pro is the full-featured Python IDE for professional programmers, and Wing Personal is a free alternative with reduced feature set.

If you do not already have Wing installed, download it now.

To get started using Wing, refer to the tutorial in the Help menu in Wing or the Quickstart Guide.

Debugging in Wing

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'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 Pro; app.run() should be used with Wing 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. 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 provides many other options and tools. For more information:

Using Wing with Flask