I tried to start a Flask application with app.run() in python shell. When I passed debug=False, it worked, but not working with debug=True which gave me the following python error:
>>> from HelloW import app
>>> app.run(debug=True, port=1234)
* Serving Flask app 'HelloW' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Restarting with stat
C:\Users\lfcta\Documents\Python\python.exe: can't find '__main__' module in 'E:\\Flask\\Flask_WTF'
where E:\Flask\Flask_WTF\Hellow.py contains the following code:
from flask import Flask
app = Flask(__name__)
@app.route('/home')
def home():
return '<h2>Hello World!</h2>'
I don't encounter this problem with the "flask run" command regardless of the debug mode.
E:\Flask\Flask_WTF>set flask_app=HelloW.py
E:\Flask\Flask_WTF>set flask_debug=1
E:\Flask\Flask_WTF>flask run // working
E:\Flask\Flask_WTF>set flask_debug=0
E:\Flask\Flask_WTF>flask run // working