Development Server

    The flask command line script (Command Line Interface) is stronglyrecommended for development because it provides a superior reloadexperience due to how it loads the application. The basic usage is likethis:

    This enables the development environment, including the interactivedebugger and reloader, and then starts the server on.

    Note

    Prior to Flask 1.0 the environment variable wasnot supported and you needed to enable debug mode by exporting. This can still be used to control debug mode, butyou should prefer setting the development environment as shownabove.

    In Code

    Example:

    This works well for the common case but it does not work well fordevelopment which is why from Flask 0.11 onwards the flaskmethod is recommended. The reason for this is that due to how the reloadmechanism works there are some bizarre side-effects (like executingcertain code twice, sometimes crashing without message or dying when asyntax or import error happens).