Reputation: 691
I have set up my first Flask project with PyCharm and this is my app.py file:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'TEST'
if __name__ == '__main__':
app.run(debug=True)
I want to run my project in debug mode so that I do not have to restart the server every time something changes. I provide the app.run function with a debug=True parameter, but this does not seem to change the debug flag. The application does start however and I do see "TEST" on the page, but this is with the debug flag set to False.
I also tried to directly change my env variable with os.environ["FLASK_DEBUG"] = "True", but this did not affect the flag also.
Any advice?
Upvotes: 0
Views: 1066
Reputation: 493
Run your flask app in command line instead of PyCharm. python3 app.py
Upvotes: 1
Reputation: 42
If you're using PyCharm, in Run/Debug config you can pass FLASK_DEBUG variable. Try to set it to "1", not to "True".
Upvotes: 1