Running Flask from IPython raises SystemExit Running Flask from IPython raises SystemExit flask flask

Running Flask from IPython raises SystemExit


You're using Jupyter Notebook or IPython to run the development server. You've also enabled debug mode, which enables the reloader by default. The reloader tries to restart the process, which IPython can't handle.

Preferably, use the flask command to run the development server.

export FLASK_APP=my_app.pyexport FLASK_DEBUG=1flask run

Or use the plain python interpreter to run the application if you still want to use app.run, which is no longer recommended.

python my_app.py

Or disable the reloader if you want to call app.run from Jupyter.

app.run(debug=True, use_reloader=False)

In Visual Studio Code, to setup flask run in the launcher (instead of launch python), use this configuration in .vscode/launch.json:

    {      "name": "Python: Flask",      "type": "python",      "request": "launch",      "module": "flask",      "env": { "FLASK_APP": "my_app.py", "FLASK_ENV": "development" },      "args": ["run"],      "args_": ["run", "--no-debugger"],            "jinja": true    }


Use this one, it works perfectly fine for me:

app.run(debug=True, use_reloader=False)


I was also having the same problem which got resolved by removing debug=True. Here's My Code

from flask import Flaskapp=Flask(__name__)@app.route('/')def home():    return "Homepage Here"if __name__=="__main__":    app.run()