D
D
Drovosek012018-12-17 23:25:48
Python
Drovosek01, 2018-12-17 23:25:48

Why does a file with a flask project need to be run from the command line?

I'm just starting to learn the Flask microframework.
I wrote the following code for testing:

from flask import Flask

app = Flask(__name__)


@app.route('/')
def home():
  return 'hello, World'

# if __name__ == '__main__':
# 	app.run()

app.run()

If I open this file in IDLE and press F5, errors will fall.
If I run this file via cmd, then everything is fine.
Why is that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2018-12-20
@ulkoart

Most likely, the environment is not configured in IDLE.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question